From: Arnaud Giersch Date: Fri, 15 Sep 2017 21:37:27 +0000 (+0200) Subject: Initialize saveptr and please dumb compilers. X-Git-Tag: v3_17~109 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/586776316687c1b369137bdbcd2107761ed5ba9a?hp=76328cc7990e1bb3a68cd48d41dd4ea929dad11f;ds=sidebyside Initialize saveptr and please dumb compilers. --- diff --git a/contrib/benchmarking_code_block/inject.h b/contrib/benchmarking_code_block/inject.h index 8d7907d472..4828114e48 100644 --- a/contrib/benchmarking_code_block/inject.h +++ b/contrib/benchmarking_code_block/inject.h @@ -66,7 +66,7 @@ static inline void xbt_inject_init(char *inputfile) if (fgets(line, 200, fpInput) == NULL) printf("Error input file is empty!"); // Skipping first row while (fgets(line, 200, fpInput) != NULL) { - char *saveptr; /* for strtok_r() */ + char *saveptr = NULL; /* for strtok_r() */ key = strtok_r(line, "\t", &saveptr); xbt_hist_t* data = xbt_dict_get_or_null(mydict, key); @@ -119,7 +119,7 @@ static inline void inject_init_starpu(char *inputfile, xbt_dict_t *dict, RngStre } while (fgets(line, MAX_LINE_INJ, fpInput) != NULL) { - char *saveptr; /* for strtok_r() */ + char *saveptr = NULL; /* for strtok_r() */ key = strtok_r(line, "\t", &saveptr); xbt_hist_t* data = xbt_dict_get_or_null(mydict, key); diff --git a/src/xbt/automaton/automatonparse_promela.c b/src/xbt/automaton/automatonparse_promela.c index 1c4b4da2cd..f35835daad 100644 --- a/src/xbt/automaton/automatonparse_promela.c +++ b/src/xbt/automaton/automatonparse_promela.c @@ -17,7 +17,7 @@ static xbt_automaton_t parsed_automaton; char* state_id_src; static void new_state(char* id, int src){ - char* saveptr; // for strtok_r() + char* saveptr = NULL; // for strtok_r() char* id_copy = xbt_strdup(id); char* first_part = strtok_r(id_copy, "_", &saveptr); int type = 0 ; // -1=initial state; 0=intermediate state; 1=final state diff --git a/src/xbt/memory_map.cpp b/src/xbt/memory_map.cpp index 0f77a8dfcf..73e2d8d487 100644 --- a/src/xbt/memory_map.cpp +++ b/src/xbt/memory_map.cpp @@ -193,7 +193,7 @@ XBT_PRIVATE std::vector get_memory_map(pid_t pid) line[read - 1] = '\0'; /* Tokenize the line using spaces as delimiters and store each token in lfields array. We expect 5 tokens for 6 fields */ - char* saveptr; // for strtok_r() + char* saveptr = nullptr; // for strtok_r() char* lfields[6]; lfields[0] = strtok_r(line, " ", &saveptr);