X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8bd1d4d43b1cbdeec15247821932f6ca0971fd96..4a69abcc786d029bd2962537f767d12a0f808d11:/src/xbt/heap.c diff --git a/src/xbt/heap.c b/src/xbt/heap.c index 96da93ec17..e32dfc4807 100644 --- a/src/xbt/heap.c +++ b/src/xbt/heap.c @@ -53,13 +53,14 @@ inline void xbt_heap_set_update_callback(xbt_heap_t H, void (*update_callback) ( */ void xbt_heap_free(xbt_heap_t H) { - int i; + if (!H) + return; + if (H->free) - for (i = 0; i < H->count; i++) + for (int i = 0; i < H->count; i++) H->free(H->items[i].content); free(H->items); free(H); - return; } /** @@ -97,7 +98,6 @@ void xbt_heap_push(xbt_heap_t H, void *content, double key) item->content = content; xbt_heap_increase_key(H, count - 1); XBT_DEBUG("Heap has now %d elements and max elem is %g",xbt_heap_size(H),xbt_heap_maxkey(H)); - return; } /** @@ -276,5 +276,4 @@ static void xbt_heap_increase_key(xbt_heap_t H, int i) } if (H->update_callback) H->update_callback(items[i].content, i); - return; }