Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] make sure variable is zeroed before writing on it
[simgrid.git] / src / instr / instr_smpi.c
index 92914be..b0e8dc1 100644 (file)
@@ -184,10 +184,7 @@ void TRACE_smpi_collective_in(int rank, int root, const char *operation)
   container_t container = PJ_container_get (str);
   type_t type = PJ_type_get ("MPI_STATE", container->type);
   const char *color = instr_find_color (operation);
-  val_t value = PJ_value_get (operation, type);
-  if (value == NULL){
-    value = PJ_value_new (operation, color, type);
-  }
+  val_t value = PJ_value_get_or_new (operation, color, type);
   new_pajePushState (SIMIX_get_clock(), container, type, value);
 }
 
@@ -213,10 +210,7 @@ void TRACE_smpi_ptp_in(int rank, int src, int dst, const char *operation)
   container_t container = PJ_container_get (str);
   type_t type = PJ_type_get ("MPI_STATE", container->type);
   const char *color = instr_find_color (operation);
-  val_t value = PJ_value_get (operation, type);
-  if (value == NULL){
-    value = PJ_value_new (operation, color, type);
-  }
+  val_t value = PJ_value_get_or_new (operation, color, type);
   new_pajePushState (SIMIX_get_clock(), container, type, value);
 }
 
@@ -237,6 +231,7 @@ void TRACE_smpi_send(int rank, int src, int dst)
   if (!TRACE_smpi_is_enabled()) return;
 
   char key[INSTR_DEFAULT_STR_SIZE];
+  bzero (key, INSTR_DEFAULT_STR_SIZE);
   TRACE_smpi_put_key(src, dst, key, INSTR_DEFAULT_STR_SIZE);
 
   char str[INSTR_DEFAULT_STR_SIZE];
@@ -252,6 +247,7 @@ void TRACE_smpi_recv(int rank, int src, int dst)
   if (!TRACE_smpi_is_enabled()) return;
 
   char key[INSTR_DEFAULT_STR_SIZE];
+  bzero (key, INSTR_DEFAULT_STR_SIZE);
   TRACE_smpi_get_key(src, dst, key, INSTR_DEFAULT_STR_SIZE);
 
   char str[INSTR_DEFAULT_STR_SIZE];