From: Kevin Day Date: Sat, 2 May 2020 04:23:24 +0000 (-0500) Subject: Cleanup: call clear macros in _new macros X-Git-Tag: 0.5.0~303 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=d739603c5ec274b9153b4e0c794e124323215358;p=fll Cleanup: call clear macros in _new macros --- diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index c023461..9cd3ef4 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -205,9 +205,7 @@ extern "C" { */ #ifndef _di_f_macro_memory_structure_new_ #define f_macro_memory_structure_new(status, structure, type, length) \ - structure.array = 0; \ - structure.size = 0; \ - structure.used = 0; \ + f_macro_memory_structure_clear(structure) \ status = f_memory_new((void **) & structure.array, sizeof(type), length); \ if (status == f_none) { \ structure.size = length; \ @@ -335,9 +333,7 @@ extern "C" { */ #ifndef _di_f_macro_memory_structures_new_ #define f_macro_memory_structures_new(status, structures, type, new_length) \ - structures.array = 0; \ - structures.size = 0; \ - structures.used = 0; \ + f_macro_memory_structures_clear(structures) \ status = f_memory_new((void **) & structures.array, sizeof(type), new_length); \ if (status == f_none) { \ structures.size = new_length; \ @@ -425,7 +421,6 @@ extern "C" { } #endif // _di_f_macro_memory_structures_destroy_simple_ - /** * Resize a generic memory structures. * diff --git a/level_0/f_string/c/string.h b/level_0/f_string/c/string.h index b3ac568..167b9da 100644 --- a/level_0/f_string/c/string.h +++ b/level_0/f_string/c/string.h @@ -312,9 +312,7 @@ extern "C" { dynamics.used = 0; #define f_macro_string_dynamics_new(status, dynamics, length) \ - dynamics.array = 0; \ - dynamics.size = 0; \ - dynamics.used = 0; \ + f_macro_string_dynamics_clear(dynamics) \ status = f_memory_new((void **) & dynamics.array, sizeof(f_string_dynamic), length); \ if (status == f_none) { \ dynamics.size = length; \