This commit is contained in:
jl777
2016-10-27 10:20:00 -03:00
parent f4d61fa7c4
commit bf301bb67f
2 changed files with 11 additions and 4 deletions

View File

@@ -198,8 +198,8 @@ void komodo_init()
if ( didinit == 0 )
{
didinit = 1;
iguana_initQ(&DepositsQ,"Deposits");
iguana_initQ(&PendingsQ,"Pendings");
iguana_initQ(&DepositsQ,(char *)"Deposits");
iguana_initQ(&PendingsQ,(char *)"Pendings");
pthread_mutex_init(&komodo_mutex,NULL);
decode_hex(NOTARY_PUBKEY33,33,(char *)NOTARY_PUBKEY.c_str());
n = (int32_t)(sizeof(Notaries)/sizeof(*Notaries));

View File

@@ -1128,6 +1128,13 @@ void myfree(void *_ptr,long allocsize)
free(item);
}
void free_queueitem(void *itemdata)
{
struct queueitem *item = (void *)((long)itemdata - sizeof(struct queueitem));
//printf("freeq item.%p itemdata.%p size.%d\n",item,itemdata,item->allocsize);
_myfree(item->type,item->allocsize,item,item->allocsize);
}
void *mycalloc(uint8_t type,int32_t n,long itemsize)
{
struct allocitem *item; int64_t allocsize = ((uint64_t)n * itemsize);
@@ -1284,7 +1291,7 @@ void iguana_initQ(queue_t *Q,char *name)
char *tst,*str = (char *)"need to init each Q when single threaded";
memset(Q,0,sizeof(*Q));
strcpy(Q->name,name);
queue_enqueue(name,Q,queueitem(str),1);
if ( (tst= queue_dequeue(Q,1)) != 0 )
queue_enqueue(name,Q,(struct queueitem *)queueitem(str),1);
if ( (tst= (char *)queue_dequeue(Q,1)) != 0 )
free_queueitem(tst);
}