Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Initialization that should be useless because of the calloc but seem to help valgrind...
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 10 Jun 2005 22:03:25 +0000 (22:03 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 10 Jun 2005 22:03:25 +0000 (22:03 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1366 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/maxmin.c
src/surf/network.c
src/xbt/swag.c

index 7d5dbf0..8c6ba2d 100644 (file)
@@ -117,12 +117,24 @@ lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id,
                                double bound, int number_of_constraints)
 {
   lmm_variable_t var = NULL;
-
+  int i;
   var = xbt_new0(s_lmm_variable_t, 1);
   var->id = id;
   var->cnsts = xbt_new0(s_lmm_element_t, number_of_constraints);
+  for(i=0; i<number_of_constraints; i++) {
+    /* Should be useless because of the 
+       calloc but it seems to help valgrind... */
+    var->cnsts[i].element_set_hookup.next = NULL;
+    var->cnsts[i].element_set_hookup.prev = NULL;
+    var->cnsts[i].active_element_set_hookup.next = NULL;
+    var->cnsts[i].active_element_set_hookup.prev = NULL;
+    var->cnsts[i].constraint = NULL;
+    var->cnsts[i].variable = NULL;
+    var->cnsts[i].value = 0.0;
+  }
   var->cnsts_size = number_of_constraints;
-  /* var->cnsts_number = 0; *//* Useless because of the calloc  */
+  var->cnsts_number = 0; /* Should be useless because of the 
+                           calloc but it seems to help valgrind... */
   var->weight = weight;
   var->bound = bound;
   var->value = 0.0;
index 848b796..f16fe4d 100644 (file)
@@ -377,7 +377,8 @@ static surf_action_t communicate(void *src, void *dst, double size, double rate)
   action->generic_action.finish = -1.0;
   action->generic_action.resource_type =
       (surf_resource_t) surf_network_resource;
-
+  action->suspended = 0;  /* Should be useless because of the 
+                            calloc but it seems to help valgrind... */
   action->generic_action.state_set =
       surf_network_resource->common_public->states.running_action_set;
 
index ec8e4c7..1b2fb7b 100644 (file)
@@ -31,7 +31,10 @@ xbt_swag_t xbt_swag_new(size_t offset)
 {
   xbt_swag_t swag = xbt_new0(s_xbt_swag_t, 1);
 
+  swag->tail = NULL;
+  swag->head = NULL;
   swag->offset = offset;
+  swag->count = 0;
 
   return swag;
 }
@@ -56,7 +59,10 @@ void xbt_swag_free(xbt_swag_t swag)
  */
 void xbt_swag_init(xbt_swag_t swag, size_t offset)
 {
+  swag->tail = NULL;
+  swag->head = NULL;
   swag->offset = offset;
+  swag->count = 0;
 }