The clear_config() is called just once at the beginning of this program, but the global variable hashtab[] is already zero-filled at the start-up.
Showing the changes to scripts/basic (1 of 1 file). Show all
Unified · Split
| @@ -191,23 +191,6 @@ static void define_config(const char *name, int len, unsigned int hash) · 190 unmodified lines | |||
| 191 | hashtab[hash % HASHSZ] = aux; | 191 | hashtab[hash % HASHSZ] = aux; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | /* | ||
| 195 | * Clear the set of configuration strings. | ||
| 196 | */ | ||
| 197 | static void clear_config(void) | ||
| 198 | { | ||
| 199 | struct item *aux, *next; | ||
| 200 | unsigned int i; | ||
| 201 | |||
| 202 | for (i = 0; i < HASHSZ; i++) { | ||
| 203 | for (aux = hashtab[i]; aux; aux = next) { | ||
| 204 | next = aux->next; | ||
| 205 | free(aux); | ||
| 206 | } | ||
| 207 | hashtab[i] = NULL; | ||
| 208 | } | ||
| 209 | } | ||
| 210 | |||
| 211 | /* | 194 | /* |
| 212 | * Record the use of a CONFIG_* word. | 195 | * Record the use of a CONFIG_* word. |
| 213 | */ | 196 | */ |
| @@ -325,8 +308,6 @@ static void parse_dep_file(void *map, size_t len) · 111 unmodified lines | |||
| 325 | int saw_any_target = 0; | 308 | int saw_any_target = 0; |
| 326 | int is_first_dep = 0; | 309 | int is_first_dep = 0; |
| 327 | 310 | ||
| 328 | clear_config(); | ||
| 329 | |||
| 330 | while (m < end) { | 311 | while (m < end) { |
| 331 | /* Skip any "white space" */ | 312 | /* Skip any "white space" */ |
| 332 | while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) | 313 | while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) |