Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
let xbt_heap_free(NULL) be a noop
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 26 Mar 2016 11:02:15 +0000 (12:02 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 26 Mar 2016 11:02:15 +0000 (12:02 +0100)
src/surf/cpu_cas01.cpp
src/surf/network_interface.hpp
src/xbt/heap.c

index fb91f38..0469a17 100644 (file)
@@ -71,9 +71,7 @@ CpuCas01Model::~CpuCas01Model()
 {
   lmm_system_free(maxminSystem_);
   maxminSystem_ = NULL;
-
-  if (actionHeap_)
-    xbt_heap_free(actionHeap_);
+  xbt_heap_free(actionHeap_);
   delete modifiedSet_;
 
   surf_cpu_model_pm = NULL;
index b5330ad..8362e85 100644 (file)
@@ -66,8 +66,7 @@ namespace simgrid {
       ~NetworkModel() {
         if (maxminSystem_)
           lmm_system_free(maxminSystem_);
-        if (actionHeap_)
-          xbt_heap_free(actionHeap_);
+        xbt_heap_free(actionHeap_);
         delete modifiedSet_;
       }
 
index 96da93e..5bfca96 100644 (file)
@@ -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;
 }
 
 /**