X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=prioq.c;fp=prioq.c;h=09d781f92389002916a688455e5d7bc385f9ed17;hb=0781d5363fb6fd723a2316fc7558aef6439b2f71;hp=43604972fe153cc59d419689bf18bcfbd5a3e1d8;hpb=d6e2dbabccb08970da991e6d2b0fda7a56d83e6f;p=catta diff --git a/prioq.c b/prioq.c index 4360497..09d781f 100644 --- a/prioq.c +++ b/prioq.c @@ -1,6 +1,6 @@ #include "prioq.h" -flxPrioQueue* flx_prio_queue_new(gint (*compare) (gpointer a, gpointer b)) { +flxPrioQueue* flx_prio_queue_new(gint (*compare) (gconstpointer a, gconstpointer b)) { flxPrioQueue *q; g_assert(compare); @@ -216,7 +216,7 @@ static void exchange_nodes(flxPrioQueue *q, flxPrioQueueNode *a, flxPrioQueueNod } /* Move a node to the correct position */ -static void shuffle_node(flxPrioQueue *q, flxPrioQueueNode *n) { +void flx_prio_queue_shuffle(flxPrioQueue *q, flxPrioQueueNode *n) { g_assert(q); g_assert(n); @@ -290,7 +290,7 @@ flxPrioQueueNode* flx_prio_queue_put(flxPrioQueue *q, gpointer data) { q->last = n; q->n_nodes++; - shuffle_node(q, n); + flx_prio_queue_shuffle(q, n); return n; } @@ -303,7 +303,7 @@ void flx_prio_queue_remove(flxPrioQueue *q, flxPrioQueueNode *n) { flxPrioQueueNode *replacement = q->last; exchange_nodes(q, replacement, n); flx_prio_queue_remove(q, q->last); - shuffle_node(q, replacement); + flx_prio_queue_shuffle(q, replacement); return; }