Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
modified atoi to strtol when getting route ends in all models
authorquasar <quasar@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 29 Nov 2007 15:52:47 +0000 (15:52 +0000)
committerquasar <quasar@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 29 Nov 2007 15:52:47 +0000 (15:52 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5094 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/simix/smx_environment.c
src/surf/network.c
src/surf/network_gtnets.c
src/surf/workstation_KCCFLN05.c
src/surf/workstation_ptask_L07.c

index 0973135..6a02bec 100644 (file)
@@ -104,15 +104,15 @@ void SIMIX_create_environment(const char *file)
     parsed = 1;        
   }
 
     parsed = 1;        
   }
 
-  
-
   surf_workstation_model_description[workstation_id].
       model_init(file);
 
   surf_workstation_model_description[workstation_id].
       model_init(file);
 
-  double s = xbt_os_time();  
-  if  (!parsed) parse_platform_file(file);
-  double e = xbt_os_time();
-  DEBUG1("PARSE TIME: %lg", (e-s));
+  if  (!parsed)  {
+    double s = xbt_os_time();  
+    parse_platform_file(file);
+    double e = xbt_os_time();
+    DEBUG1("PARSE TIME: %lg", (e-s));
+  }
 
   _simix_init_status = 2;      /* inited; don't change settings now */
 
 
   _simix_init_status = 2;      /* inited; don't change settings now */
 
index 9e7aeaa..697a674 100644 (file)
@@ -199,7 +199,7 @@ static void add_route(void)
   int link_list_capacity = 0;
   link_CM02_t *link_list = NULL;
   xbt_dict_cursor_t cursor = NULL;
   int link_list_capacity = 0;
   link_CM02_t *link_list = NULL;
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data;
+  char *key,*data, *end;
   const char *sep = "#";
   xbt_dynar_t links, keys;
 
   const char *sep = "#";
   xbt_dynar_t links, keys;
 
@@ -213,8 +213,8 @@ static void add_route(void)
     link_list_capacity = xbt_dynar_length(links);
     link_list = xbt_new(link_CM02_t, link_list_capacity);
 
     link_list_capacity = xbt_dynar_length(links);
     link_list = xbt_new(link_CM02_t, link_list_capacity);
 
-    src_id = atoi(xbt_dynar_get_as(keys, 0, char*));
-    dst_id = atoi(xbt_dynar_get_as(keys, 1, char*));
+    src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
+    dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
  
     char* link = NULL;
     xbt_dynar_foreach (links, cpt, link) {
  
     char* link = NULL;
     xbt_dynar_foreach (links, cpt, link) {
index e30d059..fb04b38 100644 (file)
@@ -272,7 +272,7 @@ static void add_route()
   unsigned int cpt = 0;    
   int i = 0;
   xbt_dict_cursor_t cursor = NULL;
   unsigned int cpt = 0;    
   int i = 0;
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data;
+  char *key,*data, *end;
   const char *sep = "#";
   xbt_dynar_t links, keys;
 
   const char *sep = "#";
   xbt_dynar_t links, keys;
 
@@ -284,8 +284,8 @@ static void add_route()
     nb_link = xbt_dynar_length(links);
     link_name = xbt_realloc(link_name, (nb_link) * sizeof(char *));
 
     nb_link = xbt_dynar_length(links);
     link_name = xbt_realloc(link_name, (nb_link) * sizeof(char *));
 
-    src_id = atoi(xbt_dynar_get_as(keys, 0, char*));
-    dst_id = atoi(xbt_dynar_get_as(keys, 1, char*));
+    src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
+    dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
   
     i = 0;
     char* link = NULL;
   
     i = 0;
     char* link = NULL;
index 7131817..6879c58 100644 (file)
@@ -1160,7 +1160,7 @@ static void parse_route_set_route(void)
 {
   char* name;
   if (src_id != -1 && dst_id != -1) {
 {
   char* name;
   if (src_id != -1 && dst_id != -1) {
-    name = bprintf("%d#%d#%lf#%lf#%lf#%lf",src_id, dst_id,impact_on_src,
+    name = bprintf("%x#%x#%lf#%lf#%lf#%lf",src_id, dst_id,impact_on_src,
              impact_on_dst, impact_on_src_with_other_recv,
              impact_on_dst_with_other_send);
 
              impact_on_dst, impact_on_src_with_other_recv,
              impact_on_dst_with_other_send);
 
@@ -1196,7 +1196,7 @@ static void add_route(void)
   int link_list_capacity = 0;
   link_KCCFLN05_t *link_list = NULL;
   xbt_dict_cursor_t cursor = NULL;
   int link_list_capacity = 0;
   link_KCCFLN05_t *link_list = NULL;
   xbt_dict_cursor_t cursor = NULL;
-  char *key,*data;
+  char *key,*data, *end;
   const char *sep = "#";
   xbt_dynar_t links, keys;
 
   const char *sep = "#";
   xbt_dynar_t links, keys;
 
@@ -1210,8 +1210,8 @@ static void add_route(void)
     link_list_capacity = xbt_dynar_length(links);
     link_list = xbt_new(link_KCCFLN05_t, link_list_capacity);
 
     link_list_capacity = xbt_dynar_length(links);
     link_list = xbt_new(link_KCCFLN05_t, link_list_capacity);
 
-    src_id = atoi(xbt_dynar_get_as(keys, 0, char*));
-    dst_id = atoi(xbt_dynar_get_as(keys, 1, char*));
+    src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
+    dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
     impact_on_src = atof(xbt_dynar_get_as(keys, 2, char*));
     impact_on_dst = atof(xbt_dynar_get_as(keys, 3, char*));
     impact_on_src_with_other_recv = atof(xbt_dynar_get_as(keys, 4, char*));
     impact_on_src = atof(xbt_dynar_get_as(keys, 2, char*));
     impact_on_dst = atof(xbt_dynar_get_as(keys, 3, char*));
     impact_on_src_with_other_recv = atof(xbt_dynar_get_as(keys, 4, char*));
index b78601f..730476e 100644 (file)
@@ -910,7 +910,7 @@ static void add_route(void)
     int link_list_capacity = 0;
     link_L07_t *link_list = NULL;
     xbt_dict_cursor_t cursor = NULL;
     int link_list_capacity = 0;
     link_L07_t *link_list = NULL;
     xbt_dict_cursor_t cursor = NULL;
-    char *key,*data;
+    char *key,*data, *end;
     const char *sep = "#";
     xbt_dynar_t links, keys;
 
     const char *sep = "#";
     xbt_dynar_t links, keys;
 
@@ -921,8 +921,8 @@ static void add_route(void)
        links = (xbt_dynar_t)data;
        keys = xbt_str_split_str(key, sep);
        
        links = (xbt_dynar_t)data;
        keys = xbt_str_split_str(key, sep);
        
-       src_id = atoi(xbt_dynar_get_as(keys, 0, char*));
-       dst_id = atoi(xbt_dynar_get_as(keys, 1, char*));
+       src_id = strtol(xbt_dynar_get_as(keys, 0, char*), &end, 16);
+       dst_id = strtol(xbt_dynar_get_as(keys, 1, char*), &end, 16);
 
        link_list_capacity = xbt_dynar_length(links);
        link_list = xbt_new(link_L07_t, link_list_capacity);
 
        link_list_capacity = xbt_dynar_length(links);
        link_list = xbt_new(link_L07_t, link_list_capacity);