From: cherierm Date: Wed, 5 Dec 2007 13:45:11 +0000 (+0000) Subject: Ansi C declaration of the variables (at the beginning of the blocks) X-Git-Tag: v3.3~737 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/cf56a22da60094d8e7f14b1457526dc194d40226?hp=1efa42ba7f4518c68673b1e644962c2e112ef96c Ansi C declaration of the variables (at the beginning of the blocks) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5111 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/simix/smx_environment.c b/src/simix/smx_environment.c index 6a02bec412..eb7782f505 100644 --- a/src/simix/smx_environment.c +++ b/src/simix/smx_environment.c @@ -39,6 +39,7 @@ void SIMIX_create_environment(const char *file) void *workstation = NULL; char *workstation_model_name; int workstation_id = -1; + double start, end; simix_config_init(); /* make sure that our configuration set is created */ surf_timer_model_init(file); @@ -97,9 +98,9 @@ void SIMIX_create_environment(const char *file) surf_cpu_model_description[cpu_id].model_init(file); surf_network_model_description[network_id].model_init(file); - double start = xbt_os_time(); + start = xbt_os_time(); parse_platform_file(file); - double end = xbt_os_time(); + end = xbt_os_time(); DEBUG1("PARSE TIME: %lg", (end-start)); parsed = 1; } @@ -108,9 +109,10 @@ void SIMIX_create_environment(const char *file) model_init(file); if (!parsed) { + double e ; double s = xbt_os_time(); parse_platform_file(file); - double e = xbt_os_time(); + e = xbt_os_time(); DEBUG1("PARSE TIME: %lg", (e-s)); } diff --git a/src/surf/network.c b/src/surf/network.c index b3b8adba47..42f6aae03f 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -206,6 +206,7 @@ static void add_route(void) if (routing_table == NULL) create_routing_table(); xbt_dict_foreach(route_table, cursor, key, data) { + char* link = NULL; nb_link = 0; links = (xbt_dynar_t)data; keys = xbt_str_split_str(key, sep); @@ -216,7 +217,7 @@ static void add_route(void) 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) { TRY { link_list[nb_link++] = xbt_dict_get(link_set, link); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 0afe41f7ae..348a8577d3 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -581,6 +581,9 @@ void parse_sets(void) char *id, *suffix, *prefix, *radical; int start, end; xbt_dynar_t radical_ends; + xbt_dynar_t current_set; + char *value; + int i; id = xbt_strdup(A_surfxml_set_id); prefix = xbt_strdup(A_surfxml_set_prefix); @@ -595,10 +598,9 @@ void parse_sets(void) surf_parse_get_int(&start, xbt_dynar_get_as(radical_ends, 0, char*)); surf_parse_get_int(&end, xbt_dynar_get_as(radical_ends, 1, char*)); - xbt_dynar_t current_set = xbt_dynar_new(sizeof(char*), NULL); + current_set = xbt_dynar_new(sizeof(char*), NULL); - char *value; - int i; + for (i=start; ievent_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL); - xbt_dynar_t list = xbt_str_split(input,"\n\r"); + list = xbt_str_split(input,"\n\r"); + - unsigned int cpt; - char * val; xbt_dynar_foreach(list, cpt, val) { linecount++; xbt_str_trim(val, " \t\n\r\x0B"); diff --git a/src/surf/workstation_KCCFLN05.c b/src/surf/workstation_KCCFLN05.c index cb8c2bd829..601f9b9ebf 100644 --- a/src/surf/workstation_KCCFLN05.c +++ b/src/surf/workstation_KCCFLN05.c @@ -1197,6 +1197,7 @@ static void add_route(void) char *key,*data, *end; const char *sep = "#"; xbt_dynar_t links, keys; + char* link = NULL; if (routing_table == NULL) create_routing_table(); @@ -1216,7 +1217,7 @@ static void add_route(void) impact_on_src_with_other_recv = 0;//atof(xbt_dynar_get_as(keys, 4, char*)); impact_on_dst_with_other_send = 0;//atof(xbt_dynar_get_as(keys, 5, char*)); - char* link = NULL; + xbt_dynar_foreach (links, cpt, link) { TRY { link_list[nb_link++] = xbt_dict_get(link_set, link); diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index 2d553aea45..3c95c6faa8 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -911,6 +911,7 @@ static void add_route(void) char *key,*data, *end; const char *sep = "#"; xbt_dynar_t links, keys; + char* link = NULL; if (routing_table == NULL) create_routing_table(); @@ -925,7 +926,7 @@ static void add_route(void) link_list_capacity = xbt_dynar_length(links); link_list = xbt_new(link_L07_t, link_list_capacity); - char* link = NULL; + xbt_dynar_foreach (links, cpt, link) { TRY { link_list[nb_link++] = xbt_dict_get(link_set, link);