Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replace a combination of malloc+strcpy by xbt_strdup.
[simgrid.git] / src / surf / network.c
index 3fb305c..3864fd9 100644 (file)
@@ -621,7 +621,7 @@ static surf_action_t net_communicate(const char *src_name,
   /* LARGE PLATFORMS HACK:
      total_route_size = route_size + src->link_nb + dst->nb */
 
-  XBT_IN_F("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
+  XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
   /* LARGE PLATFORMS HACK:
      assert on total_route_size */
   latency = global_routing->get_latency(src_name,dst_name);
@@ -733,15 +733,13 @@ static surf_action_t net_communicate(const char *src_name,
   /* LARGE PLATFORMS HACK:
      expand also with src->link and dst->link */
 #ifdef HAVE_TRACING
-  action->src_name = xbt_new(char, strlen(src_name) + 1);
-  strncpy(action->src_name, src_name, strlen(src_name) + 1);
+  action->src_name = xbt_strdup(src_name);
 
-  action->dst_name = xbt_new(char, strlen(dst_name) + 1);
-  strncpy(action->dst_name, dst_name, strlen(dst_name) + 1);
+  action->dst_name = xbt_strdup(dst_name);
 #endif
 
   xbt_dynar_free(&route);
-  XBT_OUT;
+  XBT_OUT();
 
   return (surf_action_t) action;
 }