diff -Naur ipchat/src/demux.c ipchat-trick/src/demux.c --- ipchat/src/demux.c 2005-03-23 21:08:16.596250536 +0000 +++ ipchat-trick/src/demux.c 2005-03-23 21:09:09.512206000 +0000 @@ -66,7 +66,7 @@ /* Node in timer queue. */ struct timer_pq_node { - time_t next_alarm; + prio_t next_alarm; /* must be the first field for pqueue */ unsigned long int time_incr; long int time_shift; void (*callback) (void *); diff -Naur ipchat/src/pqueue.c ipchat-trick/src/pqueue.c --- ipchat/src/pqueue.c 2005-03-23 21:05:50.008535256 +0000 +++ ipchat-trick/src/pqueue.c 2005-03-23 22:11:45.022281000 +0000 @@ -110,13 +110,17 @@ if(q->csize==q->size) pq_requeue(q); + /* + * no longer needed pq_node *node=(pq_node*)malloc(sizeof(pq_node)); node->pri=p; node->data=d; + */ int pos=++q->csize; - q->heap[pos]=node; + /* q->heap[pos]=node; */ + q->heap[pos] = (pq_node *)d; positionate(pos,q); return p; @@ -145,7 +149,7 @@ void * pq_min(pqueue *q){ if(q->csize==0) return NULL; - return q->heap[1]->data; + return (void *)q->heap[1]; } /* delete the minor priority element */ @@ -159,10 +163,13 @@ sink(1,q); q->heap[q->csize+1]=NULL; + /* void *data=pqn->data; pqn->data=NULL; free(pqn); return data; + */ + return (void *)pqn; } /* sink the node to its correct position */ @@ -197,7 +204,7 @@ int i; if(!q || !q->heap || (i=pos(p,q))==PRIERR) return NULL; - return q->heap[i]->data; + return (void *)q->heap[i]; } /* return the position in the heap of the element with priority p */ @@ -221,9 +228,12 @@ positionate(i,q); + /* void *data=aux->data; free(aux); return data; + */ + return (void *)aux; } @@ -239,10 +249,13 @@ int i=1; void *data; for(;i<(pq->csize+1);i++){ - if(pq->heap[i] && pq->equals_f(pq->heap[i]->data,data2)){ + if(pq->heap[i] && pq->equals_f((void *)pq->heap[i],data2)){ + /* data=pq->heap[i]->data; pq->heap[i]->data=NULL; free(pq->heap[i]); + */ + data=(void *)pq->heap[i]; pq->heap[i]=pq->heap[pq->csize]; pq->csize--; @@ -264,8 +277,8 @@ int i=1; for(;i<(pq->csize+1);i++){ - if(pq->heap[i] && pq->equals_f(pq->heap[i]->data,data2)) - return pq->heap[i]->data; + if(pq->heap[i] && pq->equals_f((void *)pq->heap[i],data2)) + return (void *)pq->heap[i]; } return NULL; } @@ -278,7 +291,7 @@ return PQERR; if(pq_empty(q)==PQERR) return PQERR; - free(*q->heap); + free(q->heap); return POK; } @@ -292,7 +305,7 @@ int i=1; for(;i<(q->csize+1);i++){ - if(q->heap[i] && q->equals_f(q->heap[i]->data,data)) + if(q->heap[i] && q->equals_f((void *)q->heap[i],data)) break; } diff -Naur ipchat/src/pqueue.h ipchat-trick/src/pqueue.h --- ipchat/src/pqueue.h 2005-03-23 21:07:23.523318848 +0000 +++ ipchat-trick/src/pqueue.h 2005-03-23 22:06:56.672117000 +0000 @@ -53,7 +53,7 @@ /* Priority queue node */ typedef struct { prio_t pri; /* priority */ - void * data; /* data */ + /*void * data;*/ /* data */ } pq_node; /* Priority queue struct */