X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9b757886241c3fc8c055842b3cf7fef7494031d7..aa29c3a2434a29e6901f1e98aa0c171ee15d73cc:/src/xbt/heap.c diff --git a/src/xbt/heap.c b/src/xbt/heap.c index 84eedac187..2829fe5e58 100644 --- a/src/xbt/heap.c +++ b/src/xbt/heap.c @@ -1,8 +1,7 @@ -/* $Id$ */ - /* a generic and efficient heap */ -/* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */ +/* Copyright (c) 2004, 2005, 2007, 2008, 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -128,7 +127,7 @@ void *xbt_heap_pop(xbt_heap_t H) (void *) realloc(H->items, (H->size) * sizeof(struct xbt_heapItem)); } - H->update_callback ? H->update_callback(max, -1) : NULL; + if(H->update_callback) H->update_callback(max, -1); return max; } @@ -199,10 +198,10 @@ static void xbt_heap_maxHeapify(xbt_heap_t H) struct xbt_heapItem tmp = H->items[i]; H->items[i] = H->items[greatest]; H->items[greatest] = tmp; - H->update_callback ? H->update_callback(CONTENT(H, i), i) : NULL; + if(H->update_callback) H->update_callback(CONTENT(H, i), i); i = greatest; } else { - H->update_callback ? H->update_callback(CONTENT(H, i), i) : NULL; + if(H->update_callback) H->update_callback(CONTENT(H, i), i); return; } } @@ -221,10 +220,10 @@ static void xbt_heap_increaseKey(xbt_heap_t H, int i) struct xbt_heapItem tmp = H->items[i]; H->items[i] = H->items[PARENT(i)]; H->items[PARENT(i)] = tmp; - H->update_callback ? H->update_callback(CONTENT(H, i), i) : NULL; + if(H->update_callback) H->update_callback(CONTENT(H, i), i); i = PARENT(i); } - H->update_callback ? H->update_callback(CONTENT(H, i), i) : NULL; + if(H->update_callback) H->update_callback(CONTENT(H, i), i); return; }