From: Kevin Day Date: Sun, 1 Sep 2019 20:20:09 +0000 (-0500) Subject: Cleanup: make sure memory functions are prefixed with f_memory X-Git-Tag: 0.5.0~456 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=3a8fcdc8245ad9ecb1f201d7b52018c1bc09014b;p=fll Cleanup: make sure memory functions are prefixed with f_memory --- diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index 8efc786..448d205 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -152,14 +152,14 @@ enum { typedef f_string_location f_fss_object; #define f_fss_object_initialize f_string_location_initialize - #define f_macro_fss_object_new(status, object, length) status = f_new_array((void **) & object, sizeof(f_fss_object), length) + #define f_macro_fss_object_new(status, object, length) status = f_memory_new((void **) & object, sizeof(f_fss_object), length) - #define f_macro_fss_object_delete(status, object) status = f_delete((void **) & object) - #define f_macro_fss_object_destroy(status, object, size) status = f_destroy((void **) & object, sizeof(f_fss_object), size) + #define f_macro_fss_object_delete(status, object) status = f_memory_delete((void **) & object) + #define f_macro_fss_object_destroy(status, object, size) status = f_memory_destroy((void **) & object, sizeof(f_fss_object), size) - #define f_macro_fss_object_resize(status, object, old_length, new_length) status = f_resize((void **) & object, sizeof(f_fss_object), old_length, new_length) + #define f_macro_fss_object_resize(status, object, old_length, new_length) status = f_memory_resize((void **) & object, sizeof(f_fss_object), old_length, new_length) - #define f_macro_fss_object_adjust(status, object, old_length, new_length) status = f_adjust((void **) & object, sizeof(f_fss_object), old_length, new_length) + #define f_macro_fss_object_adjust(status, object, old_length, new_length) status = f_memory_adjust((void **) & object, sizeof(f_fss_object), old_length, new_length) #endif // _di_fss_object_ /** diff --git a/level_0/f_memory/c/memory.c b/level_0/f_memory/c/memory.c index f8e86c0..49744a9 100644 --- a/level_0/f_memory/c/memory.c +++ b/level_0/f_memory/c/memory.c @@ -4,8 +4,8 @@ extern "C" { #endif -#ifndef _di_f_new_ - f_return_status f_new_array(void **pointer, const f_memory_size_t type, const f_memory_length length) { +#ifndef _di_f_memory_new_ + f_return_status f_memory_new(void **pointer, const f_memory_size_t type, const f_memory_length length) { #ifndef _di_level_0_parameter_checking_ if (type <= 0) return f_status_set_error(f_invalid_parameter); if (pointer == 0) return f_status_set_error(f_invalid_parameter); @@ -24,10 +24,10 @@ extern "C" { return f_status_set_error(f_allocation_error); } -#endif // _di_f_new_ +#endif // _di_f_memory_new_ -#if ! ( defined (_di_f_delete_) || defined (_f_memory_FORCE_secure_memory_) ) - f_return_status f_delete(void **pointer, const f_memory_size_t type, const f_memory_length length) { +#if ! ( defined (_di_f_memory_delete_) || defined (_f_memory_FORCE_secure_memory_) ) + f_return_status f_memory_delete(void **pointer, const f_memory_size_t type, const f_memory_length length) { #ifndef _di_level_0_parameter_checking_ if (pointer == 0) return f_status_set_error(f_invalid_parameter); #endif // _di_level_0_parameter_checking_ @@ -42,10 +42,10 @@ extern "C" { return f_none; } -#endif // ! ( defined (_di_f_delete_) || defined (_f_memory_FORCE_secure_memory_) ) +#endif // ! ( defined (_di_f_memory_delete_) || defined (_f_memory_FORCE_secure_memory_) ) -#if ! ( defined (_di_f_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) - f_return_status f_destroy(void **pointer, const f_memory_size_t type, const f_memory_length length) { +#if ! ( defined (_di_f_memory_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) + f_return_status f_memory_destroy(void **pointer, const f_memory_size_t type, const f_memory_length length) { #ifndef _di_level_0_parameter_checking_ if (length < 0) return f_status_set_error(f_invalid_parameter); if (type <= 0) return f_status_set_error(f_invalid_parameter); @@ -66,10 +66,10 @@ extern "C" { return f_none; } -#endif // ! ( defined (_di_f_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) +#endif // ! ( defined (_di_f_memory_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) -#if ! ( defined (_di_f_resize_) || defined (_f_memory_FORCE_secure_memory_) ) - f_return_status f_resize(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length) { +#if ! ( defined (_di_f_memory_resize_) || defined (_f_memory_FORCE_secure_memory_) ) + f_return_status f_memory_resize(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length) { #ifndef _di_level_0_parameter_checking_ if (type <= 0) return f_status_set_error(f_invalid_parameter); if (old_length < 0) return f_status_set_error(f_invalid_parameter); @@ -123,10 +123,10 @@ extern "C" { return f_status_set_error(f_reallocation_error); } -#endif // ! ( defined (_di_f_resize_) || defined (_f_memory_FORCE_secure_memory_) ) +#endif // ! ( defined (_di_f_memory_resize_) || defined (_f_memory_FORCE_secure_memory_) ) -#if ! ( defined (_di_f_adjust_) || defined (_f_memory_FORCE_fast_memory_) ) - f_return_status f_adjust(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length) { +#if ! ( defined (_di_f_memory_adjust_) || defined (_f_memory_FORCE_fast_memory_) ) + f_return_status f_memory_adjust(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length) { #ifndef _di_level_0_parameter_checking_ if (type <= 0) return f_status_set_error(f_invalid_parameter); if (old_length < 0) return f_status_set_error(f_invalid_parameter); @@ -188,7 +188,7 @@ extern "C" { return f_status_set_error(f_reallocation_error); } -#endif // ! ( defined (_di_f_adjust_) || defined (_f_memory_FORCE_fast_memory_) ) +#endif // ! ( defined (_di_f_memory_adjust_) || defined (_f_memory_FORCE_fast_memory_) ) #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index 986df81..13d7466 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -37,8 +37,8 @@ extern "C" { #endif #ifdef _f_memory_FORCE_secure_memory_ - #define f_delete(the_pointer, the_type, the_length) f_destroy(the_pointer, the_type, the_length) - #define f_resize(the_pointer, the_type, the_old_length, the_new_length) f_adjust(the_pointer, the_type, the_old_length, the_new_length) + #define f_memory_delete(the_pointer, the_type, the_length) f_memory_destroy(the_pointer, the_type, the_length) + #define f_memory_resize(the_pointer, the_type, the_old_length, the_new_length) f_memory_adjust(the_pointer, the_type, the_old_length, the_new_length) #ifdef _f_memory_FORCE_fast_memory_ #error You cannot define both _f_memory_FORCE_fast_memory_ and _f_memory_FORCE_secure_memory_ at the same time @@ -46,8 +46,8 @@ extern "C" { #endif // _f_memory_FORCE_secure_memory_ #ifdef _f_memory_FORCE_fast_memory_ - #define f_destroy(the_pointer, the_type, the_length) f_delete(the_pointer, the_type, the_length) - #define f_adjust(the_pointer, the_type, the_old_length, the_new_length) f_resize(the_pointer, the_type, the_old_length, the_new_length) + #define f_memory_destroy(the_pointer, the_type, the_length) f_memory_delete(the_pointer, the_type, the_length) + #define f_memory_adjust(the_pointer, the_type, the_old_length, the_new_length) f_memory_resize(the_pointer, the_type, the_old_length, the_new_length) #endif // _f_memory_FORCE_fast_memory_ @@ -66,43 +66,43 @@ extern "C" { #define f_memory_length size_t #endif // _di_f_memory_types_ -#ifndef _di_f_new_ +#ifndef _di_f_memory_new_ // Create some dynamically allocated array of some length - extern f_return_status f_new_array(void **pointer, const f_memory_size_t type, const f_memory_length length); -#endif // _di_f_new_ + extern f_return_status f_memory_new(void **pointer, const f_memory_size_t type, const f_memory_length length); +#endif // _di_f_memory_new_ -#if ! ( defined (_di_f_delete_) || defined (_f_memory_FORCE_secure_memory_) ) +#if ! ( defined (_di_f_memory_delete_) || defined (_f_memory_FORCE_secure_memory_) ) /** * deletes some dynamically allocated data. - * f_delete, will not change any of the data to 0 prior to deallocation. - * type and length are not used by this function normally but must be provided for the cases when f_delete is swapped with f_destroy (or vice-versa). + * f_memory_delete, will not change any of the data to 0 prior to deallocation. + * type and length are not used by this function normally but must be provided for the cases when f_memory_delete is swapped with f_memory_destroy (or vice-versa). */ - extern f_return_status f_delete(void **pointer, const f_memory_size_t type, const f_memory_length length); -#endif // ! ( defined (_di_f_delete_) || defined (_f_memory_FORCE_secure_memory_) ) + extern f_return_status f_memory_delete(void **pointer, const f_memory_size_t type, const f_memory_length length); +#endif // ! ( defined (_di_f_memory_delete_) || defined (_f_memory_FORCE_secure_memory_) ) -#if ! ( defined (_di_f_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) +#if ! ( defined (_di_f_memory_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) /** * securely deletes some dynamically allocated data. - * f_destroy, will change all data to 0 prior to deallocation. + * f_memory_destroy, will change all data to 0 prior to deallocation. */ - extern f_return_status f_destroy(void **pointer, const f_memory_size_t type, const f_memory_length length); -#endif // ! ( defined (_di_f_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) + extern f_return_status f_memory_destroy(void **pointer, const f_memory_size_t type, const f_memory_length length); +#endif // ! ( defined (_di_f_memory_destroy_) || defined (_f_memory_FORCE_fast_memory_) ) -#if ! ( defined (_di_f_resize_) || defined (_f_memory_FORCE_secure_memory_) ) +#if ! ( defined (_di_f_memory_resize_) || defined (_f_memory_FORCE_secure_memory_) ) /** * resizes some dynamically allocated data. - * f_resize, will not change any of the data prior to deallocation. + * f_memory_resize, will not change any of the data prior to deallocation. */ - extern f_return_status f_resize(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length); -#endif // ! ( defined (_di_f_resize_) || defined (_f_memory_FORCE_secure_memory_) ) + extern f_return_status f_memory_resize(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length); +#endif // ! ( defined (_di_f_memory_resize_) || defined (_f_memory_FORCE_secure_memory_) ) -#if ! ( defined (_di_f_adjust_) || defined (_f_memory_FORCE_fast_memory_) ) +#if ! ( defined (_di_f_memory_adjust_) || defined (_f_memory_FORCE_fast_memory_) ) /** * securely resizes some dynamically allocated data. - * f_adjust, will change all data to 0 prior to deallocation. + * f_memory_adjust, will change all data to 0 prior to deallocation. */ - extern f_return_status f_adjust(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length); -#endif // _di_f_adjust_ + extern f_return_status f_memory_adjust(void **pointer, const f_memory_size_t type, const f_memory_length old_length, const f_memory_length new_length); +#endif // _di_f_memory_adjust_ // centralize allocation for all FLL structures that follow the size+used approach. @@ -126,7 +126,7 @@ extern "C" { structure.array = 0; \ structure.size = 0; \ structure.used = 0; \ - status = f_new_array((void **) & structure.array, sizeof(type), length); \ + status = f_memory_new((void **) & structure.array, sizeof(type), length); \ if (status == f_none) { \ structure.size = length; \ structure.used = 0; \ @@ -141,7 +141,7 @@ extern "C" { * type: the structure type. */ #define f_macro_memory_structure_delete(status, structure, type) \ - status = f_delete((void **) & structure.array, sizeof(type), structure.size); \ + status = f_memory_delete((void **) & structure.array, sizeof(type), structure.size); \ if (status == f_none) { \ structure.size = 0; \ structure.used = 0; \ @@ -155,7 +155,7 @@ extern "C" { * type: the structure type. */ #define f_macro_memory_structure_destroy(status, structure, type) \ - status = f_destroy((void **) & structure.array, sizeof(type), structure.size); \ + status = f_memory_destroy((void **) & structure.array, sizeof(type), structure.size); \ if (status == f_none) { \ structure.size = 0; \ structure.used = 0; \ @@ -169,7 +169,7 @@ extern "C" { * type: the structure type. */ #define f_macro_memory_structure_resize(status, structure, type, new_length) \ - status = f_resize((void **) & structure.array, sizeof(type), structure.size, new_length); \ + status = f_memory_resize((void **) & structure.array, sizeof(type), structure.size, new_length); \ if (status == f_none) { \ structure.size = new_length; \ if (structure.used > structure.size) structure.used = new_length; \ @@ -183,7 +183,7 @@ extern "C" { * type: the structure type. */ #define f_macro_memory_structure_adjust(status, structure, type, new_length) \ - status = f_adjust((void **) & structure.array, sizeof(type), structure.size, new_length); \ + status = f_memory_adjust((void **) & structure.array, sizeof(type), structure.size, new_length); \ if (status == f_none) { \ structure.size = new_length; \ if (structure.used > structure.size) structure.used = new_length; \ @@ -213,7 +213,7 @@ extern "C" { structures.array = 0; \ structures.size = 0; \ structures.used = 0; \ - status = f_new_array((void **) & structures.array, sizeof(type), new_length); \ + status = f_memory_new((void **) & structures.array, sizeof(type), new_length); \ if (status == f_none) { \ structures.size = new_length; \ structures.used = 0; \ @@ -233,7 +233,7 @@ extern "C" { f_macro_memory_structure_delete(status, structures.array[structures.size], type); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_delete((void **) & structures.array, sizeof(type), structures.size); \ + if (status == f_none) status = f_memory_delete((void **) & structures.array, sizeof(type), structures.size); \ if (status == f_none) structures.used = 0; #endif // _di_f_macro_memory_structures_delete_ @@ -250,7 +250,7 @@ extern "C" { f_macro_memory_structure_destroy(status, structures.array[structures.size], type); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_destroy((void **) & structures.array, sizeof(type), structures.size); \ + if (status == f_none) status = f_memory_destroy((void **) & structures.array, sizeof(type), structures.size); \ if (status == f_none) structures.used = 0; #endif // _di_f_macro_memory_structures_destroy_ @@ -269,7 +269,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_resize((void **) & structures.array, sizeof(type), structures.size, new_length); \ + if (status == f_none) status = f_memory_resize((void **) & structures.array, sizeof(type), structures.size, new_length); \ if (status == f_none) { \ if (new_length > structures.size) { \ length_variable i = structures.size; \ @@ -297,7 +297,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_adjust((void **) & structures.array, sizeof(type), structures.size, new_length); \ + if (status == f_none) status = f_memory_adjust((void **) & structures.array, sizeof(type), structures.size, new_length); \ if (status == f_none) { \ if (new_length > structures.size) { \ length_variable i = structures.size; \ diff --git a/level_0/f_string/c/string.h b/level_0/f_string/c/string.h index 28c9d8f..8cf3b2d 100644 --- a/level_0/f_string/c/string.h +++ b/level_0/f_string/c/string.h @@ -82,15 +82,15 @@ extern "C" { #define f_string_max_size f_signed_long_size #define f_string_initialize f_string_eos - #define f_macro_string_new(status, string, length) status = f_new_array((void **) & string, sizeof(f_string), length) - #define f_macro_string_delete(status, string, size) status = f_delete((void **) & string, sizeof(f_string), size) - #define f_macro_string_destroy(status, string, size) status = f_destroy((void **) & string, sizeof(f_string), size) + #define f_macro_string_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_string), length) + #define f_macro_string_delete(status, string, size) status = f_memory_delete((void **) & string, sizeof(f_string), size) + #define f_macro_string_destroy(status, string, size) status = f_memory_destroy((void **) & string, sizeof(f_string), size) #define f_macro_string_resize(status, string, old_length, new_length) \ - status = f_resize((void **) & string, sizeof(f_string), old_length, new_length) + status = f_memory_resize((void **) & string, sizeof(f_string), old_length, new_length) #define f_macro_string_adjust(status, string, old_length, new_length) \ - status = f_adjust((void **) & string, sizeof(f_string), old_length, new_length) + status = f_memory_adjust((void **) & string, sizeof(f_string), old_length, new_length) #endif // _di_f_string_ #ifndef _di_f_string_length_ @@ -98,15 +98,15 @@ extern "C" { #define f_string_length_printf string_format_long_integer - #define f_macro_string_length_new(status, string, length) status = f_new_array((void **) & string, sizeof(f_string_length), length) - #define f_macro_string_length_delete(status, string, length) status = f_delete((void **) & string, sizeof(f_string_length), length) - #define f_macro_string_length_destroy(status, string, size) status = f_destroy((f_void_P *) & string, sizeof(f_string_length), size) + #define f_macro_string_length_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_string_length), length) + #define f_macro_string_length_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_string_length), length) + #define f_macro_string_length_destroy(status, string, size) status = f_memory_destroy((f_void_P *) & string, sizeof(f_string_length), size) #define f_macro_string_length_resize(status, length, old_length, new_length) \ - status = f_resize((void **) & length, sizeof(f_string_length), old_length, new_length) + status = f_memory_resize((void **) & length, sizeof(f_string_length), old_length, new_length) #define f_macro_string_length_adjust(status, length, old_length, new_length) \ - status = f_adjust((void **) & length, sizeof(f_string_length), old_length, new_length) + status = f_memory_adjust((void **) & length, sizeof(f_string_length), old_length, new_length) #endif // _di_f_string_length_ /** @@ -150,15 +150,15 @@ extern "C" { #define f_string_location_initialize { 1, 0 } - #define f_macro_string_location_new(status, string_location, length) status = f_new_array((void **) & string_location, sizeof(f_string_location), length) - #define f_macro_string_location_delete(status, string_location, size) status = f_delete((void **) & string_location, sizeof(f_string_location), size) - #define f_macro_string_location_destroy(status, string_location, size) status = f_destroy((void **) & string_location, sizeof(f_string_location), size) + #define f_macro_string_location_new(status, string_location, length) status = f_memory_new((void **) & string_location, sizeof(f_string_location), length) + #define f_macro_string_location_delete(status, string_location, size) status = f_memory_delete((void **) & string_location, sizeof(f_string_location), size) + #define f_macro_string_location_destroy(status, string_location, size) status = f_memory_destroy((void **) & string_location, sizeof(f_string_location), size) #define f_macro_string_location_resize(status, string_location, old_length, new_length) \ - status = f_resize((void **) & string_location, sizeof(f_string_location), old_length, new_length) + status = f_memory_resize((void **) & string_location, sizeof(f_string_location), old_length, new_length) #define f_macro_string_location_adjust(status, string_location, old_length, new_length) \ - status = f_adjust((void **) & string_location, sizeof(f_string_location), old_length, new_length) + status = f_memory_adjust((void **) & string_location, sizeof(f_string_location), old_length, new_length) #endif // _di_f_string_location_ /** @@ -218,35 +218,35 @@ extern "C" { #define f_macro_string_dynamic_new(status, dynamic, new_length) \ f_clear_string_dynamic(dynamic) \ - status = f_new_array((void **) & dynamic.string, sizeof(f_string), new_length); \ + status = f_memory_new((void **) & dynamic.string, sizeof(f_string), new_length); \ if (status == f_none) { \ dynamic.size = new_length; \ dynamic.used = 0; \ } #define f_macro_string_dynamic_delete(status, dynamic) \ - status = f_delete((void **) & dynamic.string, sizeof(f_string), dynamic.size); \ + status = f_memory_delete((void **) & dynamic.string, sizeof(f_string), dynamic.size); \ if (status == f_none) { \ dynamic.size = 0; \ dynamic.used = 0; \ } #define f_macro_string_dynamic_destroy(status, dynamic) \ - status = f_destroy((void **) & dynamic.string, sizeof(f_string), dynamic.size); \ + status = f_memory_destroy((void **) & dynamic.string, sizeof(f_string), dynamic.size); \ if (status == f_none) { \ dynamic.size = 0; \ dynamic.used = 0; \ } #define f_macro_string_dynamic_resize(status, dynamic, new_length) \ - status = f_resize((void **) & dynamic.string, sizeof(f_string), dynamic.size, new_length); \ + status = f_memory_resize((void **) & dynamic.string, sizeof(f_string), dynamic.size, new_length); \ if (status == f_none) { \ dynamic.size = new_length; \ if (dynamic.used > dynamic.size) dynamic.used = new_length; \ } #define f_macro_string_dynamic_adjust(status, dynamic, new_length) \ - status = f_adjust((void **) & dynamic.string, sizeof(f_string), dynamic.size, new_length); \ + status = f_memory_adjust((void **) & dynamic.string, sizeof(f_string), dynamic.size, new_length); \ if (status == f_none) { \ dynamic.size = new_length; \ if (dynamic.used > dynamic.size) dynamic.used = new_length; \ @@ -277,7 +277,7 @@ extern "C" { dynamics.array = 0; \ dynamics.size = 0; \ dynamics.used = 0; \ - status = f_new_array((void **) & dynamics.array, sizeof(f_string_dynamic), length); \ + status = f_memory_new((void **) & dynamics.array, sizeof(f_string_dynamic), length); \ if (status == f_none) { \ dynamics.size = length; \ dynamics.used = 0; \ @@ -290,7 +290,7 @@ extern "C" { f_macro_string_dynamic_destroy(status, dynamics.array[dynamics.size]); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_delete((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size); \ + if (status == f_none) status = f_memory_delete((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size); \ if (status == f_none) dynamics.used = 0; #define f_macro_string_dynamics_destroy(status, dynamics) \ @@ -300,7 +300,7 @@ extern "C" { f_macro_string_dynamic_destroy(status, dynamics.array[dynamics.size]); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_destroy((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size); \ + if (status == f_none) status = f_memory_destroy((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size); \ if (status == f_none) dynamics.used = 0; #define f_macro_string_dynamics_resize(status, dynamics, new_length) \ @@ -312,7 +312,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_resize((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size, new_length); \ + 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_string_length i = dynamics.size; \ @@ -333,7 +333,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_adjust((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size, new_length); \ + 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_string_length i = dynamics.size; \ diff --git a/level_0/f_utf/c/utf.h b/level_0/f_utf/c/utf.h index d75b7de..be71f1b 100644 --- a/level_0/f_utf/c/utf.h +++ b/level_0/f_utf/c/utf.h @@ -173,15 +173,15 @@ extern "C" { #define f_utf_string_max_size f_signed_long_size #define f_utf_string_initialize f_utf_character_eos - #define f_macro_utf_string_new(status, string, length) status = f_new_array((void **) & string, sizeof(f_utf_string), length) - #define f_macro_utf_string_delete(status, string, size) status = f_delete((void **) & string, sizeof(f_utf_string), size) - #define f_macro_utf_string_destroy(status, string, size) status = f_destroy((void **) & string, sizeof(f_utf_string), size) + #define f_macro_utf_string_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_utf_string), length) + #define f_macro_utf_string_delete(status, string, size) status = f_memory_delete((void **) & string, sizeof(f_utf_string), size) + #define f_macro_utf_string_destroy(status, string, size) status = f_memory_destroy((void **) & string, sizeof(f_utf_string), size) #define f_macro_utf_string_resize(status, string, old_length, new_length) \ - status = f_resize((void **) & string, sizeof(f_utf_string), old_length, new_length) + status = f_memory_resize((void **) & string, sizeof(f_utf_string), old_length, new_length) #define f_macro_utf_string_adjust(status, string, old_length, new_length) \ - status = f_adjust((void **) & string, sizeof(f_utf_string), old_length, new_length) + status = f_memory_adjust((void **) & string, sizeof(f_utf_string), old_length, new_length) #endif // _di_f_utf_string_ /** @@ -190,15 +190,15 @@ extern "C" { #ifndef _di_f_utf_string_length_ typedef f_s_long f_utf_string_length; - #define f_macro_utf_string_length_new(status, string, length) status = f_new_array((void **) & string, sizeof(f_utf_string_length), length) - #define f_macro_utf_string_length_delete(status, string, length) status = f_delete((void **) & string, sizeof(f_utf_string_length), length) - #define f_macro_utf_string_length_destroy(status, string, size) status = f_destroy((f_void_P *) & string, sizeof(f_utf_string_length), size) + #define f_macro_utf_string_length_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_utf_string_length), length) + #define f_macro_utf_string_length_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_utf_string_length), length) + #define f_macro_utf_string_length_destroy(status, string, size) status = f_memory_destroy((f_void_P *) & string, sizeof(f_utf_string_length), size) #define f_macro_utf_string_length_resize(status, length, old_length, new_length) \ - status = f_resize((void **) & length, sizeof(f_utf_string_length), old_length, new_length) + status = f_memory_resize((void **) & length, sizeof(f_utf_string_length), old_length, new_length) #define f_macro_utf_string_length_adjust(status, length, old_length, new_length) \ - status = f_adjust((void **) & length, sizeof(f_utf_string_length), old_length, new_length) + status = f_memory_adjust((void **) & length, sizeof(f_utf_string_length), old_length, new_length) #endif // _di_f_utf_string_length_ /** @@ -242,15 +242,15 @@ extern "C" { #define f_utf_string_location_initialize { 1, 0 } - #define f_macro_utf_string_location_new(status, utf_string_location, length) status = f_new_array((void **) & utf_string_location, sizeof(f_utf_string_location), length) - #define f_macro_utf_string_location_delete(status, utf_string_location, size) status = f_delete((void **) & utf_string_location, sizeof(f_utf_string_location), size) - #define f_macro_utf_string_location_destroy(status, utf_string_location, size) status = f_destroy((void **) & utf_string_location, sizeof(f_utf_string_location), size) + #define f_macro_utf_string_location_new(status, utf_string_location, length) status = f_memory_new((void **) & utf_string_location, sizeof(f_utf_string_location), length) + #define f_macro_utf_string_location_delete(status, utf_string_location, size) status = f_memory_delete((void **) & utf_string_location, sizeof(f_utf_string_location), size) + #define f_macro_utf_string_location_destroy(status, utf_string_location, size) status = f_memory_destroy((void **) & utf_string_location, sizeof(f_utf_string_location), size) #define f_macro_utf_string_location_resize(status, utf_string_location, old_length, new_length) \ - status = f_resize((void **) & utf_string_location, sizeof(f_utf_string_location), old_length, new_length) + status = f_memory_resize((void **) & utf_string_location, sizeof(f_utf_string_location), old_length, new_length) #define f_macro_utf_string_location_adjust(status, utf_string_location, old_length, new_length) \ - status = f_adjust((void **) & utf_string_location, sizeof(f_utf_string_location), old_length, new_length) + status = f_memory_adjust((void **) & utf_string_location, sizeof(f_utf_string_location), old_length, new_length) #endif // _di_f_utf_string_location_ /** @@ -310,35 +310,35 @@ extern "C" { #define f_macro_utf_string_dynamic_new(status, dynamic, new_length) \ f_clear_utf_string_dynamic(dynamic) \ - status = f_new_array((void **) & dynamic.string, sizeof(f_utf_string), new_length); \ + status = f_memory_new((void **) & dynamic.string, sizeof(f_utf_string), new_length); \ if (status == f_none) { \ dynamic.size = new_length; \ dynamic.used = 0; \ } #define f_macro_utf_string_dynamic_delete(status, dynamic) \ - status = f_delete((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size); \ + status = f_memory_delete((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size); \ if (status == f_none) { \ dynamic.size = 0; \ dynamic.used = 0; \ } #define f_macro_utf_string_dynamic_destroy(status, dynamic) \ - status = f_destroy((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size); \ + status = f_memory_destroy((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size); \ if (status == f_none) { \ dynamic.size = 0; \ dynamic.used = 0; \ } #define f_macro_utf_string_dynamic_resize(status, dynamic, new_length) \ - status = f_resize((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size, new_length); \ + status = f_memory_resize((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size, new_length); \ if (status == f_none) { \ dynamic.size = new_length; \ if (dynamic.used > dynamic.size) dynamic.used = new_length; \ } #define f_macro_utf_string_dynamic_adjust(status, dynamic, new_length) \ - status = f_adjust((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size, new_length); \ + status = f_memory_adjust((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size, new_length); \ if (status == f_none) { \ dynamic.size = new_length; \ if (dynamic.used > dynamic.size) dynamic.used = new_length; \ @@ -369,7 +369,7 @@ extern "C" { dynamics.array = 0; \ dynamics.size = 0; \ dynamics.used = 0; \ - status = f_new_array((void **) & dynamics.array, sizeof(f_utf_string_dynamic), length); \ + status = f_memory_new((void **) & dynamics.array, sizeof(f_utf_string_dynamic), length); \ if (status == f_none) { \ dynamics.size = length; \ dynamics.used = 0; \ @@ -382,7 +382,7 @@ extern "C" { f_macro_utf_string_dynamic_destroy(status, dynamics.array[dynamics.size]); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_delete((void **) & dynamics.array, sizeof(f_utf_string_dynamic), dynamics.size); \ + if (status == f_none) status = f_memory_delete((void **) & dynamics.array, sizeof(f_utf_string_dynamic), dynamics.size); \ if (status == f_none) dynamics.used = 0; #define f_macro_utf_string_dynamics_destroy(status, dynamics) \ @@ -392,7 +392,7 @@ extern "C" { f_macro_utf_string_dynamic_destroy(status, dynamics.array[dynamics.size]); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_destroy((void **) & dynamics.array, sizeof(f_utf_string_dynamic), dynamics.size); \ + if (status == f_none) status = f_memory_destroy((void **) & dynamics.array, sizeof(f_utf_string_dynamic), dynamics.size); \ if (status == f_none) dynamics.used = 0; #define f_macro_utf_string_dynamics_resize(status, dynamics, new_length) \ @@ -404,7 +404,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_resize((void **) & dynamics.array, sizeof(f_utf_string_dynamic), dynamics.size, new_length); \ + 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; \ @@ -425,7 +425,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_adjust((void **) & dynamics.array, sizeof(f_utf_string_dynamic), dynamics.size, new_length); \ + 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; \ diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index 8b61654..26c2143 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -43,11 +43,11 @@ extern "C" { } // FIXME: the second and third paramater are probably wrong - f_delete((void **) & listing[counter], sizeof(struct dirent), 0); + f_memory_delete((void **) & listing[counter], sizeof(struct dirent), 0); } // FIXME: the second and third paramater are probably wrong - f_delete((void **) & listing, sizeof(struct dirent *), 0); + f_memory_delete((void **) & listing, sizeof(struct dirent *), 0); if (length == 0) { // an empty directory diff --git a/level_3/init/c/private-init.h b/level_3/init/c/private-init.h index 1f58dd8..8f7d750 100644 --- a/level_3/init/c/private-init.h +++ b/level_3/init/c/private-init.h @@ -91,7 +91,7 @@ extern "C" { delete_init_rule(status, rules.array[rules.size]); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_delete((f_void_p *) & rules.array, sizeof(init_rule), rules.size); \ + if (status == f_none) status = f_memory_delete((f_void_p *) & rules.array, sizeof(init_rule), rules.size); \ if (status == f_none) rules.used = 0; #define f_init_rules_destroy(status, rules) \ @@ -101,7 +101,7 @@ extern "C" { destroy_init_rule(status, rules.array[rules.size]); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_destroy((f_void_p *) & rules.array, sizeof(init_rule), rules.size); \ + if (status == f_none) status = f_memory_destroy((f_void_p *) & rules.array, sizeof(init_rule), rules.size); \ if (status == f_none) rules.used = 0; #define f_init_rules_resize(status, rules, new_length) \ @@ -113,7 +113,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_resize((f_void_p *) & rules.array, sizeof(init_rule), rules.size, new_length); \ + if (status == f_none) status = f_memory_resize((f_void_p *) & rules.array, sizeof(init_rule), rules.size, new_length); \ if (status == f_none) { \ if (new_length > rules.size) { \ f_string_length i = rules.size; \ @@ -134,7 +134,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_adjust((f_void_p *) & rules.array, sizeof(init_rule), rules.size, new_length); \ + if (status == f_none) status = f_memory_adjust((f_void_p *) & rules.array, sizeof(init_rule), rules.size, new_length); \ if (status == f_none) { \ if (new_length > rules.size) { \ f_string_length i = rules.size; \ @@ -191,7 +191,7 @@ extern "C" { delete_init_category(status, categorys.array[categorys.size]); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_delete((f_void_p *) & categorys.array, sizeof(init_category), categorys.size); \ + if (status == f_none) status = f_memory_delete((f_void_p *) & categorys.array, sizeof(init_category), categorys.size); \ if (status == f_none) categorys.used = 0; #define f_init_categorys_destroy(status, categorys) \ @@ -201,7 +201,7 @@ extern "C" { destroy_init_category(status, categorys.array[categorys.size]); \ if (status != f_none) break; \ } \ - if (status == f_none) status = f_destroy((f_void_p *) & categorys.array, sizeof(init_category), categorys.size); \ + if (status == f_none) status = f_memory_destroy((f_void_p *) & categorys.array, sizeof(init_category), categorys.size); \ if (status == f_none) categorys.used = 0; #define f_init_categorys_resize(status, categorys, new_length) \ @@ -213,7 +213,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_resize((f_void_p *) & categorys.array, sizeof(init_category), categorys.size, new_length); \ + if (status == f_none) status = f_memory_resize((f_void_p *) & categorys.array, sizeof(init_category), categorys.size, new_length); \ if (status == f_none) { \ if (new_length > categorys.size) { \ f_string_length i = categorys.size; \ @@ -234,7 +234,7 @@ extern "C" { if (status != f_none) break; \ } \ } \ - if (status == f_none) status = f_adjust((f_void_p *) & categorys.array, sizeof(init_category), categorys.size, new_length); \ + if (status == f_none) status = f_memory_adjust((f_void_p *) & categorys.array, sizeof(init_category), categorys.size, new_length); \ if (status == f_none) { \ if (new_length > categorys.size) { \ f_string_length i = categorys.size; \