Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Need to have the HAVE_MMAP variable.
[simgrid.git] / src / xbt / heap.c
index 84eedac..2829fe5 100644 (file)
@@ -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;
 }