From d739603c5ec274b9153b4e0c794e124323215358 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 1 May 2020 23:23:24 -0500 Subject: [PATCH] Cleanup: call clear macros in _new macros --- level_0/f_memory/c/memory.h | 9 ++------- level_0/f_string/c/string.h | 4 +--- 2 files changed, 3 insertions(+), 10 deletions(-) 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; \ -- 1.8.3.1