Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics + warning
[simgrid.git] / src / surf / network.c
index ef75a3a..0e1bcab 100644 (file)
@@ -509,24 +509,19 @@ static double net_share_resources_lazy(double now)
               GENERIC_ACTION(action).start, now + value,
               GENERIC_ACTION(action).max_duration);
 
-    if (action->index_heap >= 0) {
-      heap_remove((surf_action_network_CM02_t) action);
-    }
-
     if (min != -1) {
-      heap_insert((surf_action_network_CM02_t) action, min,
-                  max_dur_flag ? MAX_DURATION : NORMAL);
+      heap_remove(action);
+      heap_insert(action, min, max_dur_flag ? MAX_DURATION : NORMAL);
       XBT_DEBUG("Insert at heap action(%p) min %lf now %lf", action, min,
                 now);
-    }
+    } else DIE_IMPOSSIBLE;
   }
 
   //hereafter must have already the min value for this resource model
-  if (xbt_heap_size(net_action_heap) > 0) {
+  if (xbt_heap_size(net_action_heap) > 0)
     min = xbt_heap_maxkey(net_action_heap) - now;
-  } else {
+  else
     min = -1;
-  }
 
   XBT_DEBUG("The minimum with the HEAP %lf", min);