From 965b00d2098375782a8a19c97f0a62546aaea2e6 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 8 Jul 2020 22:33:46 -0500 Subject: [PATCH] Bugfix: risky macro definition caused counter problems. Macros should be used sparingly, if at all. When macros are used, they should be used carefully. In this case, I was defining a variable "i". The substituted data also included an "i", which caused a non-obvious problem. Use a more unique counter variable name "_macro__i" to help avoid these problems in the future. --- level_0/f_directory/c/directory_type.h | 20 +++++------- level_0/f_fss/c/fss-named.h | 20 +++++------- level_0/f_fss/c/fss-nest.h | 60 ++++++++++++++-------------------- level_0/f_fss/c/fss-set.h | 20 +++++------- level_0/f_memory/c/memory-structure.h | 20 +++++------- level_0/f_string/c/string-dynamic.h | 20 +++++------- level_0/f_string/c/string-map.h | 40 +++++++++-------------- level_0/f_utf/c/utf-common.h | 20 +++++------- 8 files changed, 88 insertions(+), 132 deletions(-) diff --git a/level_0/f_directory/c/directory_type.h b/level_0/f_directory/c/directory_type.h index 8ab075a..fa16113 100644 --- a/level_0/f_directory/c/directory_type.h +++ b/level_0/f_directory/c/directory_type.h @@ -190,18 +190,16 @@ extern "C" { #define f_macro_directory_statuss_resize(status, structures, new_length) \ status = F_none; \ if (new_length < structures.size) { \ - f_array_length i = structures.size - new_length; \ - for (; i < structures.size; i++) { \ - f_macro_directory_status_delete(status, structures.array[i]); \ + for (f_array_length _macro__i = structures.size - new_length; _macro__i < structures.size; _macro__i++) { \ + f_macro_directory_status_delete(status, structures.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & structures.array, sizeof(f_directory_status), structures.size, new_length); \ if (status == F_none) { \ if (new_length > structures.size) { \ - f_array_length i = structures.size; \ - for (; i < new_length; i++) { \ - memset(&structures.array[i], 0, sizeof(f_directory_status)); \ + for (f_array_length _macro__i = structures.size; _macro__i < new_length; _macro__i++) { \ + memset(&structures.array[_macro__i], 0, sizeof(f_directory_status)); \ } \ } \ structures.size = new_length; \ @@ -211,18 +209,16 @@ extern "C" { #define f_macro_directory_statuss_adjust(status, structures, new_length) \ status = F_none; \ if (new_length < structures.size) { \ - f_array_length i = structures.size - new_length; \ - for (; i < structures.size; i++) { \ - f_macro_directory_status_destroy(status, structures.array[i]); \ + for (f_array_length _macro__i = structures.size - new_length; _macro__i < structures.size; _macro__i++) { \ + f_macro_directory_status_destroy(status, structures.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & structures.array, sizeof(f_directory_status), structures.size, new_length); \ if (status == F_none) { \ if (new_length > structures.size) { \ - f_array_length i = structures.size; \ - for (; i < new_length; i++) { \ - memset(&structures.array[i], 0, sizeof(f_directory_status)); \ + for (f_array_length _macro__i = structures.size; _macro__i < new_length; _macro__i++) { \ + memset(&structures.array[_macro__i], 0, sizeof(f_directory_status)); \ } \ } \ structures.size = new_length; \ diff --git a/level_0/f_fss/c/fss-named.h b/level_0/f_fss/c/fss-named.h index ee97308..b8a81a5 100644 --- a/level_0/f_fss/c/fss-named.h +++ b/level_0/f_fss/c/fss-named.h @@ -206,18 +206,16 @@ extern "C" { #define f_macro_fss_nameds_resize(status, sets, new_length) \ status = F_none; \ if (new_length < sets.size) { \ - f_array_length i = sets.size - new_length; \ - for (; i < sets.size; i++) { \ - f_macro_fss_named_delete(status, sets.array[i]); \ + for (f_array_length _macro__i = sets.size - new_length; _macro__i < sets.size; _macro__i++) { \ + f_macro_fss_named_delete(status, sets.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & sets.array, sizeof(f_fss_named), sets.size, new_length); \ if (status == F_none) { \ if (new_length > sets.size) { \ - f_array_length i = sets.size; \ - for (; i < new_length; i++) { \ - memset(&sets.array[i], 0, sizeof(f_fss_named)); \ + for (f_array_length _macro__i = sets.size; _macro__i < new_length; _macro__i++) { \ + memset(&sets.array[_macro__i], 0, sizeof(f_fss_named)); \ } \ } \ sets.size = new_length; \ @@ -234,18 +232,16 @@ extern "C" { #define f_macro_fss_nameds_adjust(status, sets, new_length) \ status = F_none; \ if (new_length < sets.size) { \ - f_array_length i = sets.size - new_length; \ - for (; i < sets.size; i++) { \ - f_macro_fss_named_destroy(status, sets.array[i]); \ + for (f_array_length _macro__i = sets.size - new_length; _macro__i < sets.size; _macro__i++) { \ + f_macro_fss_named_destroy(status, sets.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & sets.array, sizeof(f_fss_named), sets.size, new_length); \ if (status == F_none) { \ if (new_length > sets.size) { \ - f_array_length i = sets.size; \ - for (; i < new_length; i++) { \ - memset(&sets.array[i], 0, sizeof(f_fss_named)); \ + for (f_array_length _macro__i = sets.size; _macro__i < new_length; _macro__i++) { \ + memset(&sets.array[_macro__i], 0, sizeof(f_fss_named)); \ } \ } \ sets.size = new_length; \ diff --git a/level_0/f_fss/c/fss-nest.h b/level_0/f_fss/c/fss-nest.h index dc17a9a..94d0359 100644 --- a/level_0/f_fss/c/fss-nest.h +++ b/level_0/f_fss/c/fss-nest.h @@ -283,18 +283,16 @@ extern "C" { #define f_macro_fss_items_resize(status, items, new_length) \ status = F_none; \ if (new_length < items.size) { \ - f_array_length i = items.size - new_length; \ - for (; i < items.size; i++) { \ - f_macro_fss_item_delete(status, items.array[i]); \ + for (f_array_length _macro__i = items.size - new_length; _macro__i < items.size; _macro__i++) { \ + f_macro_fss_item_delete(status, items.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & items.array, sizeof(f_fss_item), items.size, new_length); \ if (status == F_none) { \ if (new_length > items.size) { \ - f_array_length i = items.size; \ - for (; i < new_length; i++) { \ - memset(&items.array[i], 0, sizeof(f_fss_item)); \ + for (f_array_length _macro__i = items.size; _macro__i < new_length; _macro__i++) { \ + memset(&items.array[_macro__i], 0, sizeof(f_fss_item)); \ } \ } \ items.size = new_length; \ @@ -311,18 +309,16 @@ extern "C" { #define f_macro_fss_items_adjust(status, items, new_length) \ status = F_none; \ if (new_length < items.size) { \ - length_variable i = items.size - new_length; \ - for (; i < items.size; i++) { \ - f_macro_fss_item_destroy(status, items.array[i]); \ + for (length_variable _macro__i = items.size - new_length; _macro__i < items.size; _macro__i++) { \ + f_macro_fss_item_destroy(status, items.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & items.array, sizeof(f_fss_item), items.size, new_length); \ if (status == F_none) { \ if (new_length > items.size) { \ - length_variable i = items.size; \ - for (; i < new_length; i++) { \ - memset(&items.array[i], 0, sizeof(f_fss_item)); \ + for (length_variable _macro__i = items.size; _macro__i < new_length; _macro__i++) { \ + memset(&items.array[_macro__i], 0, sizeof(f_fss_item)); \ } \ } \ items.size = new_length; \ @@ -461,18 +457,16 @@ extern "C" { #define f_macro_fss_nest_resize(status, nest, new_length) \ status = F_none; \ if (new_length < nest.size) { \ - f_array_length i = nest.size - new_length; \ - for (; i < nest.size; i++) { \ - f_macro_fss_items_delete(status, nest.depth[i]); \ + for (f_array_length _macro__i = nest.size - new_length; _macro__i < nest.size; _macro__i++) { \ + f_macro_fss_items_delete(status, nest.depth[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & nest.depth, sizeof(f_fss_items), nest.size, new_length); \ if (status == F_none) { \ if (new_length > nest.size) { \ - f_array_length i = nest.size; \ - for (; i < new_length; i++) { \ - memset(&nest.depth[i], 0, sizeof(f_fss_items)); \ + for (f_array_length _macro__i = nest.size; _macro__i < new_length; _macro__i++) { \ + memset(&nest.depth[_macro__i], 0, sizeof(f_fss_items)); \ } \ } \ nest.size = new_length; \ @@ -489,18 +483,16 @@ extern "C" { #define f_macro_fss_nest_adjust(status, nest, new_length) \ status = F_none; \ if (new_length < nest.size) { \ - f_array_length i = nest.size - new_length; \ - for (; i < nest.size; i++) { \ - f_macro_fss_items_destroy(status, nest.depth[i]); \ + for (f_array_length _macro__i = nest.size - new_length; _macro__i < nest.size; _macro__i++) { \ + f_macro_fss_items_destroy(status, nest.depth[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & nest.depth, sizeof(f_fss_item), nest.size, new_length); \ if (status == F_none) { \ if (new_length > nest.size) { \ - f_array_length i = nest.size; \ - for (; i < new_length; i++) { \ - memset(&items.depth[i], 0, sizeof(f_fss_item)); \ + for (f_array_length _macro__i = nest.size; _macro__i < new_length; _macro__i++) { \ + memset(&items.depth[_macro__i], 0, sizeof(f_fss_item)); \ } \ } \ nest.size = new_length; \ @@ -634,18 +626,16 @@ extern "C" { #define f_macro_fss_nests_resize(status, nests, new_length) \ status = F_none; \ if (new_length < nests.size) { \ - f_array_length i = nests.size - new_length; \ - for (; i < nests.size; i++) { \ - f_macro_fss_nest_delete(status, nests.array[i]); \ + for (f_array_length _macro__i = nests.size - new_length; _macro__i < nests.size; _macro__i++) { \ + f_macro_fss_nest_delete(status, nests.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & nests.array, sizeof(f_fss_nest), nests.size, new_length); \ if (status == F_none) { \ if (new_length > nests.size) { \ - f_array_length i = nests.size; \ - for (; i < new_length; i++) { \ - memset(&nests.array[i], 0, sizeof(f_fss_nest)); \ + for (f_array_length _macro__i = nests.size; _macro__i < new_length; _macro__i++) { \ + memset(&nests.array[_macro__i], 0, sizeof(f_fss_nest)); \ } \ } \ nests.size = new_length; \ @@ -662,18 +652,16 @@ extern "C" { #define f_macro_fss_nests_adjust(status, nests, new_length) \ status = F_none; \ if (new_length < nests.size) { \ - f_array_length i = nests.size - new_length; \ - for (; i < nests.size; i++) { \ - f_macro_fss_nest_destroy(status, nests.array[i]); \ + for (f_array_length _macro__i = nests.size - new_length; _macro__i < nests.size; _macro__i++) { \ + f_macro_fss_nest_destroy(status, nests.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & nests.array, sizeof(f_fss_nest), nests.size, new_length); \ if (status == F_none) { \ if (new_length > nests.size) { \ - f_array_length i = nests.size; \ - for (; i < new_length; i++) { \ - memset(&nests.array[i], 0, sizeof(f_fss_nest)); \ + for (f_array_length _macro__i = nests.size; _macro__i < new_length; _macro__i++) { \ + memset(&nests.array[_macro__i], 0, sizeof(f_fss_nest)); \ } \ } \ nests.size = new_length; \ diff --git a/level_0/f_fss/c/fss-set.h b/level_0/f_fss/c/fss-set.h index 3664c2c..bf9f751 100644 --- a/level_0/f_fss/c/fss-set.h +++ b/level_0/f_fss/c/fss-set.h @@ -202,18 +202,16 @@ extern "C" { #define f_macro_fss_sets_resize(status, sets, new_length) \ status = F_none; \ if (new_length < sets.size) { \ - f_array_length i = sets.size - new_length; \ - for (; i < sets.size; i++) { \ - f_macro_fss_set_delete(status, sets.array[i]); \ + for (f_array_length _macro__i = sets.size - new_length; _macro__i < sets.size; _macro__i++) { \ + f_macro_fss_set_delete(status, sets.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & sets.array, sizeof(f_fss_set), sets.size, new_length); \ if (status == F_none) { \ if (new_length > sets.size) { \ - f_array_length i = sets.size; \ - for (; i < new_length; i++) { \ - memset(&sets.array[i], 0, sizeof(f_fss_set)); \ + for (f_array_length _macro__i = sets.size; _macro__i < new_length; _macro__i++) { \ + memset(&sets.array[_macro__i], 0, sizeof(f_fss_set)); \ } \ } \ sets.size = new_length; \ @@ -230,18 +228,16 @@ extern "C" { #define f_macro_fss_sets_adjust(status, sets, new_length) \ status = F_none; \ if (new_length < sets.size) { \ - f_array_length i = sets.size - new_length; \ - for (; i < sets.size; i++) { \ - f_macro_fss_set_destroy(status, sets.array[i]); \ + for (f_array_length _macro__i = sets.size - new_length; _macro__i < sets.size; _macro__i++) { \ + f_macro_fss_set_destroy(status, sets.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & sets.array, sizeof(f_fss_set), sets.size, new_length); \ if (status == F_none) { \ if (new_length > sets.size) { \ - f_array_length i = sets.size; \ - for (; i < new_length; i++) { \ - memset(&sets.array[i], 0, sizeof(f_fss_set)); \ + for (f_array_length _macro__i = sets.size; _macro__i < new_length; _macro__i++) { \ + memset(&sets.array[_macro__i], 0, sizeof(f_fss_set)); \ } \ } \ sets.size = new_length; \ diff --git a/level_0/f_memory/c/memory-structure.h b/level_0/f_memory/c/memory-structure.h index e330133..7ba974a 100644 --- a/level_0/f_memory/c/memory-structure.h +++ b/level_0/f_memory/c/memory-structure.h @@ -276,18 +276,16 @@ extern "C" { #define f_macro_memory_structures_resize(status, structures, type_structure, type_structures, new_length, length_variable) \ status = F_none; \ if (new_length < structures.size) { \ - length_variable i = structures.size - new_length; \ - for (; i < structures.size; i++) { \ - f_macro_memory_structure_delete(status, structures.array[i], type_structure); \ + for (length_variable _macro__i = structures.size - new_length; _macro__i < structures.size; _macro__i++) { \ + f_macro_memory_structure_delete(status, structures.array[_macro__i], type_structure); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & structures.array, sizeof(type_structures), structures.size, new_length); \ if (status == F_none) { \ if (new_length > structures.size) { \ - length_variable i = structures.size; \ - for (; i < new_length; i++) { \ - memset(&structures.array[i], 0, sizeof(type_structures)); \ + for (length_variable _macro__i = structures.size; _macro__i < new_length; _macro__i++) { \ + memset(&structures.array[_macro__i], 0, sizeof(type_structures)); \ } \ } \ structures.size = new_length; \ @@ -309,18 +307,16 @@ extern "C" { #define f_macro_memory_structures_adjust(status, structures, type_structure, type_structures, new_length, length_variable) \ status = F_none; \ if (new_length < structures.size) { \ - length_variable i = structures.size - new_length; \ - for (; i < structures.size; i++) { \ - f_macro_memory_structure_destroy(status, structures.array[i], type_structure); \ + for (length_variable _macro__i = structures.size - new_length; _macro__i < structures.size; _macro__i++) { \ + f_macro_memory_structure_destroy(status, structures.array[_macro__i], type_structure); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & structures.array, sizeof(type_structures), structures.size, new_length); \ if (status == F_none) { \ if (new_length > structures.size) { \ - length_variable i = structures.size; \ - for (; i < new_length; i++) { \ - memset(&structures.array[i], 0, sizeof(type_structures)); \ + for (length_variable _macro__i = structures.size; _macro__i < new_length; _macro__i++) { \ + memset(&structures.array[_macro__i], 0, sizeof(type_structures)); \ } \ } \ structures.size = new_length; \ diff --git a/level_0/f_string/c/string-dynamic.h b/level_0/f_string/c/string-dynamic.h index 0bfc6bd..827b37e 100644 --- a/level_0/f_string/c/string-dynamic.h +++ b/level_0/f_string/c/string-dynamic.h @@ -205,18 +205,16 @@ extern "C" { #define f_macro_string_dynamics_resize(status, dynamics, new_length) \ status = F_none; \ if (new_length < dynamics.size) { \ - f_array_length i = dynamics.size - new_length; \ - for (; i < dynamics.size; i++) { \ - f_macro_string_dynamic_delete(status, dynamics.array[i]); \ + for (f_array_length _macro__i = dynamics.size - new_length; _macro__i < dynamics.size; _macro__i++) { \ + f_macro_string_dynamic_delete(status, dynamics.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size, new_length); \ if (status == F_none) { \ if (new_length > dynamics.size) { \ - f_array_length i = dynamics.size; \ - for (; i < new_length; i++) { \ - memset(&dynamics.array[i], 0, sizeof(f_string_dynamic)); \ + for (f_array_length _macro__i = dynamics.size; _macro__i < new_length; _macro__i++) { \ + memset(&dynamics.array[_macro__i], 0, sizeof(f_string_dynamic)); \ } \ } \ dynamics.size = new_length; \ @@ -226,18 +224,16 @@ extern "C" { #define f_macro_string_dynamics_adjust(status, dynamics, new_length) \ status = F_none; \ if (new_length < dynamics.size) { \ - f_array_length i = dynamics.size - new_length; \ - for (; i < dynamics.size; i++) { \ - f_macro_string_dynamic_destroy(status, dynamics.array[i], f_string_dynamic); \ + for (f_array_length _macro__i = dynamics.size - new_length; _macro__i < dynamics.size; _macro__i++) { \ + f_macro_string_dynamic_destroy(status, dynamics.array[_macro__i], f_string_dynamic); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size, new_length); \ if (status == F_none) { \ if (new_length > dynamics.size) { \ - f_array_length i = dynamics.size; \ - for (; i < new_length; i++) { \ - memset(&dynamics.array[i], 0, sizeof(f_string_dynamic)); \ + for (f_array_length _macro__i = dynamics.size; _macro__i < new_length; _macro__i++) { \ + memset(&dynamics.array[_macro__i], 0, sizeof(f_string_dynamic)); \ } \ } \ dynamics.size = new_length; \ diff --git a/level_0/f_string/c/string-map.h b/level_0/f_string/c/string-map.h index 51c4dab..bd4781e 100644 --- a/level_0/f_string/c/string-map.h +++ b/level_0/f_string/c/string-map.h @@ -135,18 +135,16 @@ extern "C" { #define f_macro_string_maps_resize(status, maps, new_length) \ status = F_none; \ if (new_length < maps.size) { \ - f_array_length i = maps.size - new_length; \ - for (; i < maps.size; i++) { \ - f_macro_string_map_delete(status, maps.array[i]); \ + for (f_array_length _macro__i = maps.size - new_length; _macro__i < maps.size; _macro__i++) { \ + f_macro_string_map_delete(status, maps.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & maps.array, sizeof(f_string_map), maps.size, new_length); \ if (status == F_none) { \ if (new_length > maps.size) { \ - f_array_length i = maps.size; \ - for (; i < new_length; i++) { \ - memset(&maps.array[i], 0, sizeof(f_string_map)); \ + for (f_array_length _macro__i = maps.size; _macro__i < new_length; _macro__i++) { \ + memset(&maps.array[_macro__i], 0, sizeof(f_string_map)); \ } \ } \ maps.size = new_length; \ @@ -156,18 +154,16 @@ extern "C" { #define f_macro_string_maps_adjust(status, maps, new_length) \ status = F_none; \ if (new_length < maps.size) { \ - f_array_length i = maps.size - new_length; \ - for (; i < maps.size; i++) { \ - f_macro_string_map_destroy(status, maps.array[i], f_string_map); \ + for (f_array_length _macro__i = maps.size - new_length; _macro__i < maps.size; _macro__i++) { \ + f_macro_string_map_destroy(status, maps.array[_macro__i], f_string_map); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & maps.array, sizeof(f_string_map), maps.size, new_length); \ if (status == F_none) { \ if (new_length > maps.size) { \ - f_array_length i = maps.size; \ - for (; i < new_length; i++) { \ - memset(&maps.array[i], 0, sizeof(f_string_map)); \ + for (f_array_length _macro__i = maps.size; _macro__i < new_length; _macro__i++) { \ + memset(&maps.array[_macro__i], 0, sizeof(f_string_map)); \ } \ } \ maps.size = new_length; \ @@ -290,18 +286,16 @@ extern "C" { #define f_macro_string_map_multis_resize(status, maps, new_length) \ status = F_none; \ if (new_length < maps.size) { \ - f_array_length i = maps.size - new_length; \ - for (; i < maps.size; i++) { \ - f_macro_string_map_multi_delete(status, maps.array[i]); \ + for (f_array_length _macro__i = maps.size - new_length; _macro__i < maps.size; _macro__i++) { \ + f_macro_string_map_multi_delete(status, maps.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & maps.array, sizeof(f_string_map_multi), maps.size, new_length); \ if (status == F_none) { \ if (new_length > maps.size) { \ - f_array_length i = maps.size; \ - for (; i < new_length; i++) { \ - memset(&maps.array[i], 0, sizeof(f_string_map_multi)); \ + for (f_array_length _macro__i = maps.size; _macro__i < new_length; _macro__i++) { \ + memset(&maps.array[_macro__i], 0, sizeof(f_string_map_multi)); \ } \ } \ maps.size = new_length; \ @@ -311,18 +305,16 @@ extern "C" { #define f_macro_string_map_multis_adjust(status, maps, new_length) \ status = F_none; \ if (new_length < maps.size) { \ - f_array_length i = maps.size - new_length; \ - for (; i < maps.size; i++) { \ - f_macro_string_map_multi_destroy(status, maps.array[i], f_string_map_multi); \ + for (f_array_length _macro__i = maps.size - new_length; _macro__i < maps.size; _macro__i++) { \ + f_macro_string_map_multi_destroy(status, maps.array[_macro__i], f_string_map_multi); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & maps.array, sizeof(f_string_map_multi), maps.size, new_length); \ if (status == F_none) { \ if (new_length > maps.size) { \ - f_array_length i = maps.size; \ - for (; i < new_length; i++) { \ - memset(&maps.array[i], 0, sizeof(f_string_map_multi)); \ + for (f_array_length _macro__i = maps.size; _macro__i < new_length; _macro__i++) { \ + memset(&maps.array[_macro__i], 0, sizeof(f_string_map_multi)); \ } \ } \ maps.size = new_length; \ diff --git a/level_0/f_utf/c/utf-common.h b/level_0/f_utf/c/utf-common.h index bee9cfb..d7f4643 100644 --- a/level_0/f_utf/c/utf-common.h +++ b/level_0/f_utf/c/utf-common.h @@ -453,18 +453,16 @@ extern "C" { #define f_macro_utf_string_dynamics_resize(status, dynamics, new_length) \ status = F_none; \ if (new_length < dynamics.size) { \ - f_utf_string_length i = dynamics.size - new_length; \ - for (; i < dynamics.size; i++) { \ - f_macro_utf_string_dynamic_destroy(status, dynamics.array[i]); \ + for (f_utf_string_length _macro__i = dynamics.size - new_length; _macro__i < dynamics.size; _macro__i++) { \ + f_macro_utf_string_dynamic_destroy(status, dynamics.array[_macro__i]); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_resize((void **) & dynamics.array, sizeof(f_utf_string_dynamic), dynamics.size, new_length); \ if (status == F_none) { \ if (new_length > dynamics.size) { \ - f_utf_string_length i = dynamics.size; \ - for (; i < new_length; i++) { \ - memset(&dynamics.array[i], 0, sizeof(f_utf_string_dynamic)); \ + for (f_utf_string_length _macro__i = dynamics.size; _macro__i < new_length; _macro__i++) { \ + memset(&dynamics.array[_macro__i], 0, sizeof(f_utf_string_dynamic)); \ } \ } \ dynamics.size = new_length; \ @@ -474,18 +472,16 @@ extern "C" { #define f_macro_utf_string_dynamics_adjust(status, dynamics, new_length) \ status = F_none; \ if (new_length < dynamics.size) { \ - f_utf_string_length i = dynamics.size - new_length; \ - for (; i < dynamics.size; i++) { \ - f_macro_utf_string_dynamic_destroy(status, dynamics.array[i], f_utf_string_dynamic); \ + for (f_utf_string_length _macro__i = dynamics.size - new_length; _macro__i < dynamics.size; _macro__i++) { \ + f_macro_utf_string_dynamic_destroy(status, dynamics.array[_macro__i], f_utf_string_dynamic); \ if (status != F_none) break; \ } \ } \ if (status == F_none) status = f_memory_adjust((void **) & dynamics.array, sizeof(f_utf_string_dynamic), dynamics.size, new_length); \ if (status == F_none) { \ if (new_length > dynamics.size) { \ - f_utf_string_length i = dynamics.size; \ - for (; i < new_length; i++) { \ - memset(&dynamics.array[i], 0, sizeof(f_utf_string_dynamic)); \ + for (f_utf_string_length _macro__i = dynamics.size; _macro__i < new_length; _macro__i++) { \ + memset(&dynamics.array[_macro__i], 0, sizeof(f_utf_string_dynamic)); \ } \ } \ dynamics.size = new_length; \ -- 1.8.3.1