From 6850e0596ed6e70ddca6b47f7aaf26f5da063d6f Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 1 Sep 2019 14:10:11 -0500 Subject: [PATCH] Cleanup: rename allocation macros to have f_macro_ in their name --- level_0/f_fss/c/fss.h | 82 ++++++----- level_0/f_memory/c/memory.h | 81 ++++++----- level_0/f_strings/c/strings.h | 100 +++++++------- level_0/f_types/c/types_array.h | 20 +-- level_0/f_utf/c/utf.c | 2 +- level_0/f_utf/c/utf.h | 102 +++++++------- level_1/fl_colors/c/colors.c | 2 +- level_1/fl_colors/c/colors.h | 54 ++++---- level_1/fl_console/c/console.c | 18 +-- level_1/fl_directory/c/directory.c | 4 +- level_1/fl_file/c/file.c | 4 +- level_1/fl_fss/c/fss.c | 2 +- level_1/fl_fss/c/fss_basic.c | 34 ++--- level_1/fl_fss/c/fss_basic_list.c | 18 +-- level_1/fl_fss/c/fss_extended.c | 52 +++---- level_1/fl_fss/c/fss_macro.h | 46 +++---- level_1/fl_serialized/c/serialized.c | 4 +- level_1/fl_strings/c/strings.c | 4 +- level_1/fl_utf/c/utf.c | 4 +- level_2/fll_execute/c/execute.c | 24 ++-- level_2/fll_fss/c/fss_basic.c | 10 +- level_2/fll_fss/c/fss_basic_list.c | 10 +- level_2/fll_fss/c/fss_extended.c | 8 +- level_3/firewall/c/firewall.c | 16 +-- level_3/firewall/c/private-firewall.c | 152 ++++++++++----------- level_3/firewall/c/private-firewall.h | 8 +- .../fss_basic_list_read/c/fss_basic_list_read.c | 28 ++-- .../fss_basic_list_write/c/fss_basic_list_write.c | 8 +- level_3/fss_basic_read/c/fss_basic_read.c | 28 ++-- level_3/fss_basic_write/c/fss_basic_write.c | 8 +- level_3/fss_extended_read/c/fss_extended_read.c | 28 ++-- level_3/fss_extended_write/c/fss_extended_write.c | 12 +- level_3/fss_status_code/c/fss_status_code.c | 4 +- level_3/init/c/private-init.c | 30 ++-- level_3/init/c/private-init.h | 32 ++--- level_3/status_code/c/status_code.c | 4 +- 36 files changed, 518 insertions(+), 525 deletions(-) diff --git a/level_0/f_fss/c/fss.h b/level_0/f_fss/c/fss.h index 4f1d02b..0ff55c8 100644 --- a/level_0/f_fss/c/fss.h +++ b/level_0/f_fss/c/fss.h @@ -90,13 +90,17 @@ enum { #ifndef _di_f_fss_delimits_ typedef f_string_locations f_fss_delimits; + #define f_fss_delimits_initialize f_string_locations_initialize - #define f_delete_fss_delimits(status, array) f_delete_string_location_array(status, array) - #define f_destroy_fss_delimits(status, array) f_destroy_string_location_array(status, array) + #define f_macro_fss_delimits_clear(delimits) f_macro_memory_structure_clear(delimits) + + #define f_macro_fss_delimits_new(status, delimits) f_macro_strings_string_locations_new(status, delimits) + #define f_macro_fss_delimits_delete(status, delimits) f_macro_strings_string_locations_delete(status, delimits) + #define f_macro_fss_delimits_destroy(status, delimits) f_macro_strings_string_locations_destroy(status, delimits) - #define f_resize_fss_delimits(status, array, new_length) f_resize_string_location_array(status, array, new_length) - #define f_adjust_fss_delimits(status, array, new_length) f_adjust_string_location_array(status, array, new_length) + #define f_macro_fss_delimits_resize(status, delimits, new_length) f_macro_strings_string_locations_resize(status, delimits, new_length) + #define f_macro_fss_delimits_adjust(status, delimits, new_length) f_macro_strings_string_locations_adjust(status, delimits , new_length) #endif // _di_f_fss_delimits_ /** @@ -129,18 +133,15 @@ enum { #define f_fss_headers_initialize { 0, 0, 0 } - #define f_delete_fss_headers(status, headers) \ - f_delete_structure(status, headers, f_fss_header) + #define f_clear_fss_headers(headers) f_macro_memory_structure_clear(headers) - #define f_destroy_fss_headers(status, headers) \ - f_destroy_structure(status, headers, f_fss_header) + #define f_macro_fss_headers_new(status, headers, length) f_macro_memory_structure_new(status, headers, f_fss_header, length) - #define f_resize_fss_headers(status, headers, new_length) \ - f_resize_structure(status, headers, f_fss_header, new_length) + #define f_macro_fss_headers_delete(status, headers) f_macro_memory_structure_delete(status, headers, f_fss_header) + #define f_macro_fss_headers_destroy(status, headers) f_macro_memory_structure_destroy(status, headers, f_fss_header) - - #define f_adjust_fss_headers(status, headers, new_length) \ - f_adjust_structure(status, headers, f_fss_header, new_length) + #define f_macro_fss_headers_resize(status, headers, new_length) f_macro_memory_structure_resize(status, headers, f_fss_header, new_length) + #define f_macro_fss_headers_adjust(status, headers, new_length) f_macro_memory_structure_adjust(status, headers, f_fss_header, new_length) #endif // _di_f_fss_headers_ @@ -151,15 +152,14 @@ enum { typedef f_string_location f_fss_object; #define f_fss_object_initialize f_string_location_initialize - #define f_new_fss_object(status, object, length) status = f_new_array((void **) & object, sizeof(f_fss_object), length) - #define f_delete_fss_object(status, object) status = f_delete((void **) & object) - #define f_destroy_fss_object(status, object, size) status = f_destroy((void **) & object, sizeof(f_fss_object), size) + #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_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_resize_fss_object(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_resize((void **) & object, sizeof(f_fss_object), old_length, new_length) - #define f_adjust_fss_object(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_adjust((void **) & object, sizeof(f_fss_object), old_length, new_length) #endif // _di_fss_object_ /** @@ -177,17 +177,15 @@ enum { #define f_fss_objects_initialize { 0, 0, 0 } - #define f_delete_fss_objects(status, objects) \ - f_delete_structure(status, objects, f_fss_object) + #define f_macro_fss_objects_clear(objects) f_macro_memory_structure_clear(objects) - #define f_destroy_fss_objects(status, objects) \ - f_destroy_structure(status, objects, f_fss_object) + #define f_macro_fss_objects_new(status, objects, length) f_macro_memory_structure_new(status, objects, f_fss_object, length) - #define f_resize_fss_objects(status, objects, new_length) \ - f_resize_structure(status, objects, f_fss_object, new_length) + #define f_macro_fss_objects_delete(status, objects) f_macro_memory_structure_delete(status, objects, f_fss_object) + #define f_macro_fss_objects_destroy(status, objects) f_macro_memory_structure_destroy(status, objects, f_fss_object) - #define f_adjust_fss_objects(status, objects, new_length) \ - f_destroy_structure(status, objects, f_fss_object, new_length) + #define f_macro_fss_objects_resize(status, objects, new_length) f_macro_memory_structure_resize(status, objects, f_fss_object, new_length) + #define f_macro_fss_objects_adjust(status, objects, new_length) f_macro_memory_structure_destroy(status, objects, f_fss_object, new_length) #endif // _di_fss_objects_ /** @@ -208,17 +206,15 @@ enum { #define f_fss_content_initialize { 0, 0, 0 } - #define f_delete_fss_content(status, content) \ - f_delete_structure(status, content, f_string_location) + #define f_macro_fss_content_clear(content) f_macro_memory_structure_new(content) - #define f_destroy_fss_content(status, content) \ - f_destroy_structure(status, content, f_string_location) + #define f_macro_fss_content_new(status, content, length) f_macro_memory_structure_new(status, content, f_string_location, length) - #define f_resize_fss_content(status, content, new_length) \ - f_resize_structure(status, content, f_string_location, new_length) + #define f_macro_fss_content_delete(status, content) f_macro_memory_structure_delete(status, content, f_string_location) + #define f_macro_fss_content_destroy(status, content) f_macro_memory_structure_destroy(status, content, f_string_location) - #define f_adjust_fss_content(status, content, new_length) \ - f_adjust_structure(status, content, f_string_location, new_length) + #define f_macro_fss_content_resize(status, content, new_length) f_macro_memory_structure_resize(status, content, f_string_location, new_length) + #define f_macro_fss_content_adjust(status, content, new_length) f_macro_memory_structure_adjust(status, content, f_string_location, new_length) #endif // _di_fss_content_ /** @@ -236,17 +232,15 @@ enum { #define f_fss_contents_initialize { 0, 0, 0 } - #define f_delete_fss_contents(status, contents) \ - f_delete_structures(status, contents, f_fss_content) + #define f_macro_fss_contents_clear(contents) f_macro_memory_structures_clear(contents) - #define f_destroy_fss_contents(status, contents) \ - f_destroy_structures(status, contents, f_fss_content) + #define f_macro_fss_contents_new(status, contents, length) f_macro_memory_structures_delete(status, contents, f_fss_content, length) - #define f_resize_fss_contents(status, contents, new_length) \ - f_resize_structures(status, contents, f_fss_content, new_length, f_array_length) + #define f_macro_fss_contents_delete(status, contents) f_macro_memory_structures_delete(status, contents, f_fss_content) + #define f_macro_fss_contents_destroy(status, contents) f_macro_memory_structures_destroy(status, contents, f_fss_content) - #define f_adjust_fss_contents(status, contents, new_length) \ - f_resize_structures(status, contents, f_fss_content, new_length, f_array_length) + #define f_macro_fss_contents_resize(status, contents, new_length) f_macro_memory_structures_resize(status, contents, f_fss_content, new_length, f_array_length) + #define f_macro_fss_contents_adjust(status, contents, new_length) f_macro_memory_structures_resize(status, contents, f_fss_content, new_length, f_array_length) #endif // _di_f_fss_contents_ #ifdef __cplusplus diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index 4456793..5170fff 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -68,7 +68,6 @@ extern "C" { #ifndef _di_f_new_ // Create some dynamically allocated array of some length - #define f_new(pointer,type) f_new_array(pointer, type, 1) extern f_return_status f_new_array(void **pointer, const f_memory_size_t type, const f_memory_length length); #endif // _di_f_new_ @@ -107,23 +106,23 @@ extern "C" { // centralize allocation for all FLL structures that follow the size+used approach. -#ifndef _di_f_clear_structure_ +#ifndef _di_f_macro_memory_structure_clear_ /** * structure: the structure to operate on. */ - #define f_clear_structure(structure) \ + #define f_macro_memory_structure_clear(structure) \ structure.array = 0; \ structure.size = 0; \ structure.used = 0; -#endif // _di_f_clear_structure_ +#endif // _di_f_macro_memory_structure_clear_ -#ifndef _di_f_new_structure_ +#ifndef _di_f_macro_memory_structure_new_ /** * status: the status to return. * structure: the structure to operate on. * type: the structure type. */ - #define f_new_structure(status, structure, type, length) \ + #define f_macro_memory_structure_new(status, structure, type, length) \ structure.array = 0; \ structure.size = 0; \ structure.used = 0; \ @@ -132,85 +131,85 @@ extern "C" { structure.size = length; \ structure.used = 0; \ } -#endif // _di_f_new_structure_ +#endif // _di_f_macro_memory_structure_new_ // improper use of these defines can lead to memory leaks and compilation errors -#ifndef _di_f_delete_structure_ +#ifndef _di_f_macro_memory_structure_delete_ /** * status: the status to return. * structure: the structure to operate on. * type: the structure type. */ - #define f_delete_structure(status, structure, type) \ + #define f_macro_memory_structure_delete(status, structure, type) \ status = f_delete((void **) & structure.array, sizeof(type), structure.size); \ if (status == f_none) { \ structure.size = 0; \ structure.used = 0; \ } -#endif // _di_f_delete_structure_ +#endif // _di_f_macro_memory_structure_delete_ -#ifndef _di_f_destroy_structure_ +#ifndef _di_f_macro_memory_structure_destroy_ /** * status: the status to return. * structure: the structure to operate on. * type: the structure type. */ - #define f_destroy_structure(status, structure, type) \ + #define f_macro_memory_structure_destroy(status, structure, type) \ status = f_destroy((void **) & structure.array, sizeof(type), structure.size); \ if (status == f_none) { \ structure.size = 0; \ structure.used = 0; \ } -#endif // _di_f_destroy_structure_ +#endif // _di_f_macro_memory_structure_destroy_ -#ifndef _di_f_resize_structure_ +#ifndef _di_f_macro_memory_structure_resize_ /** * status: the status to return. * structure: the structure to operate on. * type: the structure type. */ - #define f_resize_structure(status, structure, type, new_length) \ + #define f_macro_memory_structure_resize(status, structure, type, new_length) \ status = f_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; \ } -#endif // _di_f_resize_structure_ +#endif // _di_f_macro_memory_structure_resize_ -#ifndef _di_f_adjust_structure_ +#ifndef _di_f_macro_memory_structure_adjust_ /** * status: the status to return. * structure: the structure to operate on. * type: the structure type. */ - #define f_adjust_structure(status, structure, type, new_length) \ + #define f_macro_memory_structure_adjust(status, structure, type, new_length) \ status = f_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; \ } -#endif // _di_f_adjust_structure_ +#endif // _di_f_macro_memory_structure_adjust_ // Structures defines function in the same way that the structure defines do // however, these hold an array of structure // improper use of these defines can lead to memory leaks and compilation errors -#ifndef _di_f_clear_structures_ +#ifndef _di_f_macro_memory_structures_clear_ /** * structure: the structure to operate on. */ - #define f_clear_structures(structures) \ + #define f_macro_memory_structures_clear(structures) \ structures.array = 0; \ structures.size = 0; \ structures.used = 0; -#endif // _di_f_clear_structures_ +#endif // _di_f_macro_memory_structures_clear_ -#ifndef _di_f_new_structures_ +#ifndef _di_f_macro_memory_structures_new_ /** * status: the status to return. * structures: the structure to operate on. * type: the structure type. */ - #define f_new_structures(status, structures, type, new_length) \ + #define f_macro_memory_structures_new(status, structures, type, new_length) \ structures.array = 0; \ structures.size = 0; \ structures.used = 0; \ @@ -219,54 +218,54 @@ extern "C" { structures.size = new_length; \ structures.used = 0; \ } -#endif // _di_f_new_structures_ +#endif // _di_f_macro_memory_structures_new_ -#ifndef _di_f_delete_structures_ +#ifndef _di_f_macro_memory_structures_delete_ /** * status: the status to return. * structures: the structure to operate on. * type: the structure type. */ - #define f_delete_structures(status, structures, type) \ + #define f_macro_memory_structures_delete(status, structures, type) \ status = f_none; \ while (structures.size > 0) { \ --structures.size; \ - f_delete_structure(status, structures.array[structures.size], type); \ + 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) structures.used = 0; -#endif // _di_f_delete_structures_ +#endif // _di_f_macro_memory_structures_delete_ -#ifndef _di_f_destroy_structures_ +#ifndef _di_f_macro_memory_structures_destroy_ /** * status: the status to return. * structures: the structure to operate on. * type: the structure type. */ - #define f_destroy_structures(status, structures, type) \ + #define f_macro_memory_structures_destroy(status, structures, type) \ status = f_none; \ while (structures.size > 0) { \ --structures.size; \ - f_destroy_structure(status, structures.array[structures.size], type); \ + 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) structures.used = 0; -#endif // _di_f_destroy_structures_ +#endif // _di_f_macro_memory_structures_destroy_ -#ifndef _di_f_resize_structures_ +#ifndef _di_f_macro_memory_structures_resize_ /** * status: the status to return. * structures: the structure to operate on. * type: the structure type. */ - #define f_resize_structures(status, structures, type, new_length, length_variable) \ + #define f_macro_memory_structures_resize(status, structures, type, 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_delete_structure(status, structures.array[i], type); \ + f_macro_memory_structure_delete(status, structures.array[i], type); \ if (status != f_none) break; \ } \ } \ @@ -281,20 +280,20 @@ extern "C" { structures.size = new_length; \ if (structures.used > structures.size) structures.used = new_length; \ } -#endif // _di_f_resize_structures_ +#endif // _di_f_macro_memory_structures_resize_ -#ifndef _di_f_adjust_structures_ +#ifndef _di_f_macro_memory_structures_adjust_ /** * status: the status to return. * structures: the structure to operate on. * type: the structure type. */ - #define f_adjust_structures(status, structures, type, new_length, length_variable) \ + #define f_macro_memory_structures_adjust(status, structures, type, 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_destroy_structure(status, structures.array[i], type); \ + f_macro_memory_structure_destroy(status, structures.array[i], type); \ if (status != f_none) break; \ } \ } \ @@ -309,7 +308,7 @@ extern "C" { structures.size = new_length; \ if (structures.used > structures.size) structures.used = new_length; \ } -#endif // _di_f_adjust_structures_ +#endif // _di_f_macro_memory_structures_adjust_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_strings/c/strings.h b/level_0/f_strings/c/strings.h index a7437b7..ad76920 100644 --- a/level_0/f_strings/c/strings.h +++ b/level_0/f_strings/c/strings.h @@ -82,14 +82,14 @@ extern "C" { #define f_string_max_size f_signed_long_size #define f_string_initialize f_eos - #define f_new_string(status, string, length) status = f_new_array((void **) & string, sizeof(f_string), length) - #define f_delete_string(status, string, size) status = f_delete((void **) & string, sizeof(f_string), size) - #define f_destroy_string(status, string, size) status = f_destroy((void **) & string, sizeof(f_string), size) + #define f_macro_strings_string_new(status, string, length) status = f_new_array((void **) & string, sizeof(f_string), length) + #define f_macro_strings_string_delete(status, string, size) status = f_delete((void **) & string, sizeof(f_string), size) + #define f_macro_strings_string_destroy(status, string, size) status = f_destroy((void **) & string, sizeof(f_string), size) - #define f_resize_string(status, string, old_length, new_length) \ + #define f_macro_strings_string_resize(status, string, old_length, new_length) \ status = f_resize((void **) & string, sizeof(f_string), old_length, new_length) - #define f_adjust_string(status, string, old_length, new_length) \ + #define f_macro_strings_string_adjust(status, string, old_length, new_length) \ status = f_adjust((void **) & string, sizeof(f_string), old_length, new_length) #endif // _di_f_have_string_ @@ -98,14 +98,14 @@ extern "C" { #define f_string_length_printf string_format_long_integer - #define f_new_string_length(status, string, length) status = f_new_array((void **) & string, sizeof(f_string_length), length) - #define f_delete_string_length(status, string, length) status = f_delete((void **) & string, sizeof(f_string_length), length) - #define f_destroy_string_length(status, string, size) status = f_destroy((f_void_P *) & string, sizeof(f_string_length), size) + #define f_macro_strings_string_length_new(status, string, length) status = f_new_array((void **) & string, sizeof(f_string_length), length) + #define f_macro_strings_string_length_delete(status, string, length) status = f_delete((void **) & string, sizeof(f_string_length), length) + #define f_macro_strings_string_length_destroy(status, string, size) status = f_destroy((f_void_P *) & string, sizeof(f_string_length), size) - #define f_resize_string_length(status, length, old_length, new_length) \ + #define f_macro_strings_string_length_resize(status, length, old_length, new_length) \ status = f_resize((void **) & length, sizeof(f_string_length), old_length, new_length) - #define f_adjust_string_length(status, length, old_length, new_length) \ + #define f_macro_strings_string_length_adjust(status, length, old_length, new_length) \ status = f_adjust((void **) & length, sizeof(f_string_length), old_length, new_length) #endif // _di_f_string_length_ @@ -122,20 +122,20 @@ extern "C" { #define f_string_lengths_initialize { 0, 0, 0 } - #define f_new_string_lengths(status, lengths) \ - f_new_structure(status, lengths, f_string_length) + #define f_macro_strings_string_lengths_new(status, lengths) \ + f_macro_memory_structure_new(status, lengths, f_string_length) - #define f_delete_string_lengths(status, lengths) \ - f_delete_structure(status, lengths, f_string_length) + #define f_macro_strings_string_lengths_delete(status, lengths) \ + f_macro_memory_structure_delete(status, lengths, f_string_length) - #define f_destroy_string_lengths(status, lengths) \ - f_destroy_structure(status, lengths, f_string_length) + #define f_macro_strings_string_lengths_destroy(status, lengths) \ + f_macro_memory_structure_destroy(status, lengths, f_string_length) - #define f_resize_string_lengths(status, lengths, new_length) \ - f_resize_structure(status, lengths, f_string_length, new_length) + #define f_macro_strings_string_lengths_resize(status, lengths, new_length) \ + f_macro_memory_structure_resize(status, lengths, f_string_length, new_length) - #define f_adjust_string_lengths(status, lengths, new_length) \ - f_adjust_structure(status, lengths, f_string_length, new_length) + #define f_macro_strings_string_lengths_adjust(status, lengths, new_length) \ + f_macro_memory_structure_adjust(status, lengths, f_string_length, new_length) #endif // _di_f_string_lengths_ /** @@ -150,14 +150,14 @@ extern "C" { #define f_string_location_initialize { 1, 0 } - #define f_new_string_location(status, string_location, length) status = f_new_array((void **) & string_location, sizeof(f_string_location), length) - #define f_delete_string_location(status, string_location, size) status = f_delete((void **) & string_location, sizeof(f_string_location), size) - #define f_destroy_string_location(status, string_location, size) status = f_destroy((void **) & string_location, sizeof(f_string_location), size) + #define f_macro_strings_string_location_new(status, string_location, length) status = f_new_array((void **) & string_location, sizeof(f_string_location), length) + #define f_macro_strings_string_location_delete(status, string_location, size) status = f_delete((void **) & string_location, sizeof(f_string_location), size) + #define f_macro_strings_string_location_destroy(status, string_location, size) status = f_destroy((void **) & string_location, sizeof(f_string_location), size) - #define f_resize_string_location(status, string_location, old_length, new_length) \ + #define f_macro_strings_string_location_resize(status, string_location, old_length, new_length) \ status = f_resize((void **) & string_location, sizeof(f_string_location), old_length, new_length) - #define f_adjust_string_location(status, string_location, old_length, new_length) \ + #define f_macro_strings_string_location_adjust(status, string_location, old_length, new_length) \ status = f_adjust((void **) & string_location, sizeof(f_string_location), old_length, new_length) #endif // _di_f_string_location_ @@ -177,22 +177,22 @@ extern "C" { #define f_string_locations_initialize {0, 0, 0} #define f_clear_string_locations(locations) \ - f_clear_structure(locations) + f_macro_memory_structure_clear(locations) - #define f_new_string_locations(status, locations, length) \ - f_new_structure(status, locations, f_string_location, length) + #define f_macro_strings_string_locations_new(status, locations, length) \ + f_macro_memory_structure_new(status, locations, f_string_location, length) - #define f_delete_string_locations(status, locations) \ - f_delete_structure(status, locations, f_string_location) + #define f_macro_strings_string_locations_delete(status, locations) \ + f_macro_memory_structure_delete(status, locations, f_string_location) - #define f_destroy_string_locations(status, locations) \ - f_destroy_structure(status, locations, f_string_location) + #define f_macro_strings_string_locations_destroy(status, locations) \ + f_macro_memory_structure_destroy(status, locations, f_string_location) - #define f_resize_string_locations(status, locations, new_length) \ - f_resize_structure(status, locations, f_string_location, new_length) + #define f_macro_strings_string_locations_resize(status, locations, new_length) \ + f_macro_memory_structure_resize(status, locations, f_string_location, new_length) - #define f_adjust_string_locations(status, locations, new_length) \ - f_adjust_structure(status, locations, f_string_location, new_length) + #define f_macro_strings_string_locations_adjust(status, locations, new_length) \ + f_macro_memory_structure_adjust(status, locations, f_string_location, new_length) #endif // _di_f_string_locations_ /** @@ -216,7 +216,7 @@ extern "C" { dynamic.size = 0; \ dynamic.used = 0; - #define f_new_dynamic_string(status, dynamic, new_length) \ + #define f_macro_string_dynamic_new(status, dynamic, new_length) \ f_clear_dynamic_string(dynamic) \ status = f_new_array((void **) & dynamic.string, sizeof(f_string), new_length); \ if (status == f_none) { \ @@ -224,28 +224,28 @@ extern "C" { dynamic.used = 0; \ } - #define f_delete_dynamic_string(status, dynamic) \ + #define f_macro_string_dynamic_delete(status, dynamic) \ status = f_delete((void **) & dynamic.string, sizeof(f_string), dynamic.size); \ if (status == f_none) { \ dynamic.size = 0; \ dynamic.used = 0; \ } - #define f_destroy_dynamic_string(status, dynamic) \ + #define f_macro_string_dynamic_destroy(status, dynamic) \ status = f_destroy((void **) & dynamic.string, sizeof(f_string), dynamic.size); \ if (status == f_none) { \ dynamic.size = 0; \ dynamic.used = 0; \ } - #define f_resize_dynamic_string(status, dynamic, new_length) \ + #define f_macro_string_dynamic_resize(status, dynamic, new_length) \ status = f_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_adjust_dynamic_string(status, dynamic, 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); \ if (status == f_none) { \ dynamic.size = new_length; \ @@ -273,7 +273,7 @@ extern "C" { dynamics.size = 0; \ dynamics.used = 0; - #define f_new_dynamic_strings(status, dynamics, length) \ + #define f_macro_string_dynamics_new(status, dynamics, length) \ dynamics.array = 0; \ dynamics.size = 0; \ dynamics.used = 0; \ @@ -283,32 +283,32 @@ extern "C" { dynamics.used = 0; \ } - #define f_delete_dynamic_strings(status, dynamics) \ + #define f_macro_string_dynamics_delete(status, dynamics) \ status = f_none; \ while (dynamics.size > 0) { \ --dynamics.size; \ - f_destroy_dynamic_string(status, dynamics.array[dynamics.size]); \ + 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_dynamic_string), dynamics.size); \ if (status == f_none) dynamics.used = 0; - #define f_destroy_dynamic_strings(status, dynamics) \ + #define f_macro_string_dynamics_destroy(status, dynamics) \ status = f_none; \ while (dynamics.size > 0) { \ --dynamics.size; \ - f_destroy_dynamic_string(status, dynamics.array[dynamics.size]); \ + 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_dynamic_string), dynamics.size); \ if (status == f_none) dynamics.used = 0; - #define f_resize_dynamic_strings(status, dynamics, new_length) \ + #define f_macro_string_dynamics_resize(status, dynamics, new_length) \ status = f_none; \ if (new_length < dynamics.size) { \ f_string_length i = dynamics.size - new_length; \ for (; i < dynamics.size; ++i) { \ - f_destroy_dynamic_string(status, dynamics.array[i]); \ + f_macro_string_dynamic_destroy(status, dynamics.array[i]); \ if (status != f_none) break; \ } \ } \ @@ -324,12 +324,12 @@ extern "C" { if (dynamics.used > dynamics.size) dynamics.used = new_length; \ } - #define f_adjust_dynamic_strings(status, dynamics, new_length) \ + #define f_macro_string_dynamics_adjust(status, dynamics, new_length) \ status = f_none; \ if (new_length < dynamics.size) { \ f_string_length i = dynamics.size - new_length; \ for (; i < dynamics.size; ++i) { \ - f_destroy_dynamic_string(status, dynamics.array[i], f_dynamic_string); \ + f_macro_string_dynamic_destroy(status, dynamics.array[i], f_dynamic_string); \ if (status != f_none) break; \ } \ } \ diff --git a/level_0/f_types/c/types_array.h b/level_0/f_types/c/types_array.h index 36c0e7c..3f786f7 100644 --- a/level_0/f_types/c/types_array.h +++ b/level_0/f_types/c/types_array.h @@ -31,20 +31,20 @@ extern "C" { #define f_array_lengths_initialize { 0, 0, 0 } - #define f_new_array_lengths(status, lengths, length) \ - f_new_structure(status, lengths, f_array_length, length) + #define f_macro_types_array_lengths_new(status, lengths, length) \ + f_macro_memory_structure_new(status, lengths, f_array_length, length) - #define f_delete_array_lengths(status, lengths) \ - f_delete_structure(status, lengths, f_array_length) + #define f_macro_types_array_lengths_delete(status, lengths) \ + f_macro_memory_structure_delete(status, lengths, f_array_length) - #define f_destroy_array_lengths(status, lengths) \ - f_destroy_structure(status, lengths, f_array_length) + #define f_macro_types_array_lengths_destroy(status, lengths) \ + f_macro_memory_structure_destroy(status, lengths, f_array_length) - #define f_resize_array_lengths(status, lengths, new_length) \ - f_resize_structure(status, lengths, f_array_length, new_length) + #define f_macro_types_array_lengths_resize(status, lengths, new_length) \ + f_macro_memory_structure_resize(status, lengths, f_array_length, new_length) - #define f_adjust_array_lengths(status, lengths, new_length) \ - f_adjust_structure(status, lengths, f_array_length, new_length) + #define f_macro_types_array_lengths_adjust(status, lengths, new_length) \ + f_macro_memory_structure_adjust(status, lengths, f_array_length, new_length) #endif // _di_f_array_lengths_ #ifdef __cplusplus diff --git a/level_0/f_utf/c/utf.c b/level_0/f_utf/c/utf.c index 6105c5a..0b694c4 100644 --- a/level_0/f_utf/c/utf.c +++ b/level_0/f_utf/c/utf.c @@ -856,7 +856,7 @@ extern "C" { f_u_short width = f_macro_utf_character_width_is(utf_character); if (max_width == 0) { - f_new_string(status, *character, width); + f_macro_strings_string_new(status, *character, width); if (f_status_is_error(status)) return status; diff --git a/level_0/f_utf/c/utf.h b/level_0/f_utf/c/utf.h index 68fcbb4..51df91c 100644 --- a/level_0/f_utf/c/utf.h +++ b/level_0/f_utf/c/utf.h @@ -171,16 +171,16 @@ extern "C" { typedef f_utf_character *f_utf_string; #define f_utf_string_max_size f_signed_long_size - #define f_utf_string_initialize f_eos + #define f_utf_string_initialize f_utf_character_eos - #define f_new_utf_char(status, string, length) status = f_new_array((void **) & string, sizeof(f_utf_string), length) - #define f_delete_utf_char(status, string, size) status = f_delete((void **) & string, sizeof(f_utf_string), size) - #define f_destroy_utf_char(status, string, size) status = f_destroy((void **) & string, sizeof(f_utf_string), size) + #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_resize_utf_char(status, string, old_length, new_length) \ + #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) - #define f_adjust_utf_char(status, 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) #endif // _di_f_utf_string_ @@ -190,14 +190,14 @@ extern "C" { #ifndef _di_f_utf_string_length_ typedef f_s_long f_utf_string_length; - #define f_new_utf_string_length(status, string, length) status = f_new_array((void **) & string, sizeof(f_utf_string_length), length) - #define f_delete_utf_string_length(status, string, length) status = f_delete((void **) & string, sizeof(f_utf_string_length), length) - #define f_destroy_utf_string_length(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_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_resize_utf_string_length(status, length, old_length, new_length) \ + #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) - #define f_adjust_utf_string_length(status, 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) #endif // _di_f_utf_string_length_ @@ -214,20 +214,20 @@ extern "C" { #define f_utf_string_lengths_initialize { 0, 0, 0 } - #define f_new_utf_string_lengths(status, lengths) \ - f_new_structure(status, lengths, f_utf_string_length) + #define f_macro_utf_string_length_news(status, lengths) \ + f_macro_memory_structure_new(status, lengths, f_utf_string_length) - #define f_delete_utf_string_lengths(status, lengths) \ - f_delete_structure(status, lengths, f_utf_string_length) + #define f_macro_utf_string_length_deletes(status, lengths) \ + f_macro_memory_structure_delete(status, lengths, f_utf_string_length) - #define f_destroy_utf_string_lengths(status, lengths) \ - f_destroy_structure(status, lengths, f_utf_string_length) + #define f_macro_utf_string_length_destroys(status, lengths) \ + f_macro_memory_structure_destroy(status, lengths, f_utf_string_length) - #define f_resize_utf_string_lengths(status, lengths, new_length) \ - f_resize_structure(status, lengths, f_utf_string_length, new_length) + #define f_macro_utf_string_length_resizes(status, lengths, new_length) \ + f_macro_memory_structure_resize(status, lengths, f_utf_string_length, new_length) - #define f_adjust_utf_string_lengths(status, lengths, new_length) \ - f_adjust_structure(status, lengths, f_utf_string_length, new_length) + #define f_macro_utf_string_length_adjusts(status, lengths, new_length) \ + f_macro_memory_structure_adjust(status, lengths, f_utf_string_length, new_length) #endif // _di_f_utf_string_lengths_ /** @@ -242,14 +242,14 @@ extern "C" { #define f_utf_string_location_initialize { 1, 0 } - #define f_new_utf_string_location(status, utf_string_location, length) status = f_new_array((void **) & utf_string_location, sizeof(f_utf_string_location), length) - #define f_delete_utf_string_location(status, utf_string_location, size) status = f_delete((void **) & utf_string_location, sizeof(f_utf_string_location), size) - #define f_destroy_utf_string_location(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_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_resize_utf_string_location(status, utf_string_location, old_length, new_length) \ + #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) - #define f_adjust_utf_string_location(status, 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) #endif // _di_f_utf_string_location_ @@ -269,22 +269,22 @@ extern "C" { #define f_utf_string_locations_initialize {0, 0, 0} #define f_clear_utf_string_locations(locations) \ - f_clear_structure(locations) + f_macro_memory_structure_clear(locations) - #define f_new_utf_string_locations(status, locations, length) \ - f_new_structure(status, locations, f_utf_string_location, length) + #define f_macro_utf_string_location_news(status, locations, length) \ + f_macro_memory_structure_new(status, locations, f_utf_string_location, length) - #define f_delete_utf_string_locations(status, locations) \ - f_delete_structure(status, locations, f_utf_string_location) + #define f_macro_utf_string_location_deletes(status, locations) \ + f_macro_memory_structure_delete(status, locations, f_utf_string_location) - #define f_destroy_utf_string_locations(status, locations) \ - f_destroy_structure(status, locations, f_utf_string_location) + #define f_macro_utf_string_location_destroys(status, locations) \ + f_macro_memory_structure_destroy(status, locations, f_utf_string_location) - #define f_resize_utf_string_locations(status, locations, new_length) \ - f_resize_structure(status, locations, f_utf_string_location, new_length) + #define f_macro_utf_string_location_resizes(status, locations, new_length) \ + f_macro_memory_structure_resize(status, locations, f_utf_string_location, new_length) - #define f_adjust_utf_string_locations(status, locations, new_length) \ - f_adjust_structure(status, locations, f_utf_string_location, new_length) + #define f_macro_utf_string_location_adjusts(status, locations, new_length) \ + f_macro_memory_structure_adjust(status, locations, f_utf_string_location, new_length) #endif // _di_f_utf_string_locations_ /** @@ -308,7 +308,7 @@ extern "C" { dynamic.size = 0; \ dynamic.used = 0; - #define f_new_utf_string_dynamic(status, dynamic, new_length) \ + #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); \ if (status == f_none) { \ @@ -316,28 +316,28 @@ extern "C" { dynamic.used = 0; \ } - #define f_delete_utf_string_dynamic(status, dynamic) \ + #define f_macro_utf_string_dynamic_delete(status, dynamic) \ status = f_delete((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size); \ if (status == f_none) { \ dynamic.size = 0; \ dynamic.used = 0; \ } - #define f_destroy_utf_string_dynamic(status, dynamic) \ + #define f_macro_utf_string_dynamic_destroy(status, dynamic) \ status = f_destroy((void **) & dynamic.string, sizeof(f_utf_string), dynamic.size); \ if (status == f_none) { \ dynamic.size = 0; \ dynamic.used = 0; \ } - #define f_resize_utf_string_dynamic(status, dynamic, new_length) \ + #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); \ if (status == f_none) { \ dynamic.size = new_length; \ if (dynamic.used > dynamic.size) dynamic.used = new_length; \ } - #define f_adjust_utf_string_dynamic(status, dynamic, 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); \ if (status == f_none) { \ dynamic.size = new_length; \ @@ -365,7 +365,7 @@ extern "C" { dynamics.size = 0; \ dynamics.used = 0; - #define f_new_utf_string_dynamics(status, dynamics, length) \ + #define f_macro_utf_string_dynamics_new(status, dynamics, length) \ dynamics.array = 0; \ dynamics.size = 0; \ dynamics.used = 0; \ @@ -375,32 +375,32 @@ extern "C" { dynamics.used = 0; \ } - #define f_delete_utf_string_dynamics(status, dynamics) \ + #define f_macro_utf_string_dynamics_delete(status, dynamics) \ status = f_none; \ while (dynamics.size > 0) { \ --dynamics.size; \ - f_destroy_utf_string_dynamic(status, dynamics.array[dynamics.size]); \ + 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) dynamics.used = 0; - #define f_destroy_utf_string_dynamics(status, dynamics) \ + #define f_macro_utf_string_dynamics_destroy(status, dynamics) \ status = f_none; \ while (dynamics.size > 0) { \ --dynamics.size; \ - f_destroy_utf_string_dynamic(status, dynamics.array[dynamics.size]); \ + 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) dynamics.used = 0; - #define f_resize_utf_string_dynamics(status, dynamics, new_length) \ + #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_destroy_utf_string_dynamic(status, dynamics.array[i]); \ + f_macro_utf_string_dynamic_destroy(status, dynamics.array[i]); \ if (status != f_none) break; \ } \ } \ @@ -416,12 +416,12 @@ extern "C" { if (dynamics.used > dynamics.size) dynamics.used = new_length; \ } - #define f_adjust_utf_string_dynamics(status, dynamics, new_length) \ + #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_destroy_utf_string_dynamic(status, dynamics.array[i], f_utf_string_dynamic); \ + f_macro_utf_string_dynamic_destroy(status, dynamics.array[i], f_utf_string_dynamic); \ if (status != f_none) break; \ } \ } \ diff --git a/level_1/fl_colors/c/colors.c b/level_1/fl_colors/c/colors.c index 6b3860c..ec116f1 100644 --- a/level_1/fl_colors/c/colors.c +++ b/level_1/fl_colors/c/colors.c @@ -50,7 +50,7 @@ extern "C" { if (buffer->size - buffer->used - 1 < string_size) { f_status status = f_none; - f_resize_dynamic_string(status, (*buffer), buffer->used + string_size + 1); // the additional 1 is the EOS + f_macro_string_dynamic_resize(status, (*buffer), buffer->used + string_size + 1); // the additional 1 is the EOS if (f_status_is_error(status)) { return status; diff --git a/level_1/fl_colors/c/colors.h b/level_1/fl_colors/c/colors.h index f041504..4b4af76 100644 --- a/level_1/fl_colors/c/colors.h +++ b/level_1/fl_colors/c/colors.h @@ -45,37 +45,37 @@ extern "C" { #define fl_color_context_initialize { f_colors_initialize_linux, f_colors_format_initialize_linux, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize } #define fl_new_color_context(status, color_context) \ - f_resize_dynamic_string(status, color_context.reset, f_color_max_size + 1); \ - if (f_status_is_not_error(status)) f_resize_dynamic_string(status, color_context.warning, f_color_max_size + 1); \ - if (f_status_is_not_error(status)) f_resize_dynamic_string(status, color_context.error, f_color_max_size + 1); \ - if (f_status_is_not_error(status)) f_resize_dynamic_string(status, color_context.title, f_color_max_size + 1); \ - if (f_status_is_not_error(status)) f_resize_dynamic_string(status, color_context.notable, f_color_max_size + 1); \ - if (f_status_is_not_error(status)) f_resize_dynamic_string(status, color_context.important, f_color_max_size + 1); \ - if (f_status_is_not_error(status)) f_resize_dynamic_string(status, color_context.standout, f_color_max_size + 1); \ - if (f_status_is_not_error(status)) f_resize_dynamic_string(status, color_context.normal, f_color_max_size + 1); \ - if (f_status_is_not_error(status)) f_resize_dynamic_string(status, color_context.normal_reset, f_color_max_size + 1); + f_macro_string_dynamic_resize(status, color_context.reset, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.warning, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.error, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.title, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.notable, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.important, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.standout, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.normal, f_color_max_size + 1); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_resize(status, color_context.normal_reset, f_color_max_size + 1); #define fl_delete_color_context(status, color_context) \ - f_delete_dynamic_string(status, color_context.reset); \ - if (f_status_is_not_error(status)) f_delete_dynamic_string(status, color_context.warning); \ - if (f_status_is_not_error(status)) f_delete_dynamic_string(status, color_context.error); \ - if (f_status_is_not_error(status)) f_delete_dynamic_string(status, color_context.title); \ - if (f_status_is_not_error(status)) f_delete_dynamic_string(status, color_context.notable); \ - if (f_status_is_not_error(status)) f_delete_dynamic_string(status, color_context.important); \ - if (f_status_is_not_error(status)) f_delete_dynamic_string(status, color_context.standout); \ - if (f_status_is_not_error(status)) f_delete_dynamic_string(status, color_context.normal); \ - if (f_status_is_not_error(status)) f_delete_dynamic_string(status, color_context.normal_reset); + f_macro_string_dynamic_delete(status, color_context.reset); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.warning); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.error); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.title); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.notable); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.important); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.standout); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.normal); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_delete(status, color_context.normal_reset); #define fl_destroy_color_context(status, color_context, size) \ - f_destroy_dynamic_string(status, color_context.reset); \ - if (f_status_is_not_error(status)) f_destroy_dynamic_string(status, color_context.warning, size); \ - if (f_status_is_not_error(status)) f_destroy_dynamic_string(status, color_context.error, size); \ - if (f_status_is_not_error(status)) f_destroy_dynamic_string(status, color_context.title, size); \ - if (f_status_is_not_error(status)) f_destroy_dynamic_string(status, color_context.notable, size); \ - if (f_status_is_not_error(status)) f_destroy_dynamic_string(status, color_context.important, size); \ - if (f_status_is_not_error(status)) f_destroy_dynamic_string(status, color_context.standout, size); \ - if (f_status_is_not_error(status)) f_destroy_dynamic_string(status, color_context.normal); \ - if (f_status_is_not_error(status)) f_destroy_dynamic_string(status, color_context.normal_reset); + f_macro_string_dynamic_destroy(status, color_context.reset); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.warning, size); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.error, size); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.title, size); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.notable, size); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.important, size); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.standout, size); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.normal); \ + if (f_status_is_not_error(status)) f_macro_string_dynamic_destroy(status, color_context.normal_reset); #endif // _di_fl_color_context_ /** diff --git a/level_1/fl_console/c/console.c b/level_1/fl_console/c/console.c index 425b791..0719cbb 100644 --- a/level_1/fl_console/c/console.c +++ b/level_1/fl_console/c/console.c @@ -68,10 +68,10 @@ extern "C" { if (parameters[parameter_counter].additional.used >= parameters[parameter_counter].additional.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, parameters[parameter_counter].additional, parameters[parameter_counter].additional.size + f_console_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, parameters[parameter_counter].additional, parameters[parameter_counter].additional.size + f_console_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(status, needs_additional); + f_macro_strings_string_lengths_delete(status, needs_additional); return f_status_set_error(allocation_status); } } @@ -124,10 +124,10 @@ extern "C" { if (needs_additional.used + parameters[parameter_counter].has_additional > needs_additional.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, needs_additional, needs_additional.used + parameters[parameter_counter].has_additional); + f_macro_strings_string_lengths_resize(allocation_status, needs_additional, needs_additional.used + parameters[parameter_counter].has_additional); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(status, needs_additional); + f_macro_strings_string_lengths_delete(status, needs_additional); return f_status_set_error(allocation_status); } } @@ -167,10 +167,10 @@ extern "C" { if (needs_additional.used + parameters[parameter_counter].has_additional > needs_additional.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, needs_additional, needs_additional.used + parameters[parameter_counter].has_additional); + f_macro_strings_string_lengths_resize(allocation_status, needs_additional, needs_additional.used + parameters[parameter_counter].has_additional); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(status, needs_additional); + f_macro_strings_string_lengths_delete(status, needs_additional); return f_status_set_error(allocation_status); } } @@ -190,10 +190,10 @@ extern "C" { if (remaining->used >= remaining->size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, (*remaining), remaining->size + f_console_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, (*remaining), remaining->size + f_console_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(status, needs_additional); + f_macro_strings_string_lengths_delete(status, needs_additional); return f_status_set_error(allocation_status); } } @@ -215,7 +215,7 @@ extern "C" { { f_status allocation_status = f_none; - f_delete_string_lengths(allocation_status, needs_additional); + f_macro_strings_string_lengths_delete(allocation_status, needs_additional); } return status; diff --git a/level_1/fl_directory/c/directory.c b/level_1/fl_directory/c/directory.c index 150ff44..490ae3a 100644 --- a/level_1/fl_directory/c/directory.c +++ b/level_1/fl_directory/c/directory.c @@ -25,14 +25,14 @@ extern "C" { // there is no reason to include "." and ".." in the directory listing if (strncmp(listing[counter]->d_name, "..", 3) != 0 && strncmp(listing[counter]->d_name, ".", 2) != 0) { if (names->used >= names->size) { - f_resize_dynamic_strings(status, (*names), names->used + fl_directory_default_allocation_step); + f_macro_string_dynamics_resize(status, (*names), names->used + fl_directory_default_allocation_step); if (f_status_is_error(status)) { return status; } } - f_resize_dynamic_string(status, names->array[names->used], size); + f_macro_string_dynamic_resize(status, names->array[names->used], size); if (f_status_is_error(status)) { return status; } diff --git a/level_1/fl_file/c/file.c b/level_1/fl_file/c/file.c index 050d0c0..a61d7e4 100644 --- a/level_1/fl_file/c/file.c +++ b/level_1/fl_file/c/file.c @@ -32,7 +32,7 @@ extern "C" { // populate the buffer do { if (buffer->size <= size) { - f_resize_dynamic_string(status, (*buffer), size); + f_macro_string_dynamic_resize(status, (*buffer), size); if (f_status_is_error(status)) { return status; @@ -77,7 +77,7 @@ extern "C" { // populate the buffer do { if (buffer->size <= size) { - f_resize_dynamic_string(status, (*buffer), size); + f_macro_string_dynamic_resize(status, (*buffer), size); if (f_status_is_error(status)) { return status; diff --git a/level_1/fl_fss/c/fss.c b/level_1/fl_fss/c/fss.c index 006607f..f10f792 100644 --- a/level_1/fl_fss/c/fss.c +++ b/level_1/fl_fss/c/fss.c @@ -211,7 +211,7 @@ extern "C" { // 1: Prepare the buffer to handle a size of f_fss_max_header_length location.total_elements = f_fss_max_header_length; - f_adjust_dynamic_string(status, buffer, location.total_elements + 1); + f_macro_string_dynamic_adjust(status, buffer, location.total_elements + 1); if (f_status_is_error(status)) { return status; diff --git a/level_1/fl_fss/c/fss_basic.c b/level_1/fl_fss/c/fss_basic.c index 310042d..3cee4be 100644 --- a/level_1/fl_fss/c/fss_basic.c +++ b/level_1/fl_fss/c/fss_basic.c @@ -98,10 +98,10 @@ extern "C" { if (delimits.used >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -195,10 +195,10 @@ extern "C" { if (delimits.used + (slash_count / 2) >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -234,7 +234,7 @@ extern "C" { { f_status allocation_status = f_none; - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); } status = fl_fss_increment_buffer(*buffer, input, 1); @@ -270,10 +270,10 @@ extern "C" { if (delimits.used + (slash_count / 2) >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -335,7 +335,7 @@ extern "C" { { f_status allocation_status = f_none; - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); } status = fl_fss_increment_buffer(*buffer, input, 1); @@ -355,7 +355,7 @@ extern "C" { { f_status allocation_status = f_none; - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); } status = fl_fss_increment_buffer(*buffer, input, 1); @@ -383,7 +383,7 @@ extern "C" { { f_status allocation_status = f_none; - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); } @@ -474,7 +474,7 @@ extern "C" { pre_allocate_size = buffer->used + (input->stop - input->start) + 3 + f_fss_default_allocation_step_string; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); if (f_status_is_error(status)) return status; } @@ -505,7 +505,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -522,7 +522,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -560,7 +560,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -583,7 +583,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -613,7 +613,7 @@ extern "C" { pre_allocate_size += slash_count; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -704,7 +704,7 @@ extern "C" { buffer_position.stop = buffer->used; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); if (f_status_is_error(status)) return status; } diff --git a/level_1/fl_fss/c/fss_basic_list.c b/level_1/fl_fss/c/fss_basic_list.c index 174bdce..335d2f7 100644 --- a/level_1/fl_fss/c/fss_basic_list.c +++ b/level_1/fl_fss/c/fss_basic_list.c @@ -92,10 +92,10 @@ extern "C" { if (delimits.used + (slash_count / 2) >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -292,10 +292,10 @@ extern "C" { if (delimits.used + (slash_count / 2) >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -414,7 +414,7 @@ extern "C" { pre_allocate_size = buffer->used + (input->stop - input->start) + 2 + f_fss_default_allocation_step_string; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); if (f_status_is_error(status)) return status; } @@ -476,7 +476,7 @@ extern "C" { pre_allocate_size += slash_count; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -551,7 +551,7 @@ extern "C" { pre_allocate_size = buffer->used + (input->stop - input->start) + 2 + f_fss_default_allocation_step_string; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); if (f_status_is_error(status)) return status; } @@ -611,7 +611,7 @@ extern "C" { pre_allocate_size += slash_count + 1; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -657,7 +657,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } diff --git a/level_1/fl_fss/c/fss_extended.c b/level_1/fl_fss/c/fss_extended.c index acc6fb9..4ddf9c8 100644 --- a/level_1/fl_fss/c/fss_extended.c +++ b/level_1/fl_fss/c/fss_extended.c @@ -93,10 +93,10 @@ extern "C" { if (delimits.used >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -186,10 +186,10 @@ extern "C" { if (delimits.used + (slash_count / 2) >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -254,10 +254,10 @@ extern "C" { if (delimits.used + (slash_count / 2) >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -395,11 +395,11 @@ extern "C" { quoted = f_eos; if (found->used >= found->size) { - f_resize_fss_content(status, (*found), found->size + f_fss_default_allocation_step); + f_macro_fss_content_resize(status, (*found), found->size + f_fss_default_allocation_step); if (f_status_is_error(status)){ f_status allocation_status = f_none; - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return status; } @@ -465,10 +465,10 @@ extern "C" { if (delimits.used >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -559,10 +559,10 @@ extern "C" { if (delimits.used + (slash_count / 2) >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -627,10 +627,10 @@ extern "C" { if (delimits.used + (slash_count / 2) >= delimits.size) { f_status allocation_status = f_none; - f_resize_string_lengths(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); + f_macro_strings_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step); if (f_status_is_error(allocation_status)) { - f_delete_string_lengths(allocation_status, delimits); + f_macro_strings_string_lengths_delete(allocation_status, delimits); return allocation_status; } } @@ -796,7 +796,7 @@ extern "C" { pre_allocate_size = buffer->used + (input->stop - input->start) + 3 + f_fss_default_allocation_step_string; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); if (f_status_is_error(status)) return status; } @@ -826,7 +826,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -843,7 +843,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -899,7 +899,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -922,7 +922,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -952,7 +952,7 @@ extern "C" { pre_allocate_size += slash_count; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -1044,7 +1044,7 @@ extern "C" { buffer_position.stop = buffer->used; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size); if (f_status_is_error(status)) return status; } @@ -1102,7 +1102,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -1119,7 +1119,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -1145,7 +1145,7 @@ extern "C" { pre_allocate_size += 2; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -1202,7 +1202,7 @@ extern "C" { pre_allocate_size += slash_count + 1; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } @@ -1230,7 +1230,7 @@ extern "C" { pre_allocate_size++; if (pre_allocate_size > buffer->size) { - f_resize_dynamic_string(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), pre_allocate_size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } diff --git a/level_1/fl_fss/c/fss_macro.h b/level_1/fl_fss/c/fss_macro.h index 7ab0ed9..b6d6a17 100644 --- a/level_1/fl_fss/c/fss_macro.h +++ b/level_1/fl_fss/c/fss_macro.h @@ -27,7 +27,7 @@ extern "C" { i++; \ } \ \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ } #endif // _di_fl_macro_fss_apply_delimit_placeholders_ @@ -45,14 +45,14 @@ extern "C" { #define fl_macro_fss_object_return_on_overflow(buffer, input, found, delimits, eos_status, stop_status) \ if (input.start >= buffer.used) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.stop = buffer.used - 1; \ return eos_status; \ } \ else if (input.start > input.stop) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.stop = input.stop; \ return stop_status; \ @@ -69,7 +69,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.stop = buffer.used - 1; \ return eos_status; \ @@ -82,7 +82,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.stop = input.stop; \ return stop_status; \ @@ -93,14 +93,14 @@ extern "C" { #define fl_macro_fss_content_return_on_overflow(buffer, input, found, delimits, eos_status, stop_status) \ if (input.start >= buffer.used) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.array[found.used].stop = buffer.used - 1; \ return eos_status; \ } \ else if (input.start > input.stop) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.array[found.used].stop = input.stop; \ return stop_status; \ @@ -117,7 +117,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.array[found.used].stop = buffer.used - 1; \ return eos_status; \ @@ -130,7 +130,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.array[found.used].stop = input.stop; \ return stop_status; \ @@ -141,7 +141,7 @@ extern "C" { #define fl_macro_fss_content_return_on_overflow_reset(buffer, input, found, delimits, eos_status, stop_status, set_stop) \ if (input.start >= buffer.used) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ input.start = set_stop; \ found.array[found.used].stop = set_stop; \ @@ -149,7 +149,7 @@ extern "C" { } \ else if (input.start > input.stop) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ input.start = set_stop; \ found.array[found.used].stop = set_stop; \ @@ -167,7 +167,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ input.start = set_stop; \ found.array[found.used].stop = set_stop; \ @@ -181,7 +181,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ input.start = set_stop; \ found.array[found.used].stop = set_stop; \ @@ -194,10 +194,10 @@ extern "C" { if (content.used >= content.size) { \ f_status status = f_none; \ \ - f_resize_fss_content(status, content, content.size + f_fss_default_allocation_step); \ + f_macro_fss_content_resize(status, content, content.size + f_fss_default_allocation_step); \ if (f_status_is_error(status)) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ return status; \ } \ @@ -210,13 +210,13 @@ extern "C" { ++input.start; \ if (input.start >= buffer.used) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ return eos_status; \ } \ if (input.start > input.stop) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ return stop_status; \ } \ @@ -235,7 +235,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ return eos_status; \ } \ @@ -247,7 +247,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ return stop_status; \ } \ @@ -260,14 +260,14 @@ extern "C" { ++input.start; \ if (input.start >= buffer.used) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.array[found.used].stop = input.stop; \ return eos_status; \ } \ if (input.start > input.stop) { \ f_status allocation_status = f_none; \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.array[found.used].stop = input.stop; \ return stop_status; \ @@ -287,7 +287,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.array[found.used].stop = input.stop; \ return eos_status; \ @@ -300,7 +300,7 @@ extern "C" { buffer.string[delimits.array[i]] = f_fss_delimit_placeholder; \ i++; \ } \ - f_delete_string_lengths(allocation_status, delimits); \ + f_macro_strings_string_lengths_delete(allocation_status, delimits); \ \ found.array[found.used].stop = input.stop; \ return stop_status; \ diff --git a/level_1/fl_serialized/c/serialized.c b/level_1/fl_serialized/c/serialized.c index ea9c7b3..bf9750e 100644 --- a/level_1/fl_serialized/c/serialized.c +++ b/level_1/fl_serialized/c/serialized.c @@ -13,7 +13,7 @@ extern "C" { f_status status = f_none; if (serialized->used + value.used + 1 >= serialized->size) { - f_resize_dynamic_string(status, (*serialized), serialized->size + value.used + 1); + f_macro_string_dynamic_resize(status, (*serialized), serialized->size + value.used + 1); if (f_status_is_error(status)) return status; } @@ -50,7 +50,7 @@ extern "C" { if (serialized.string[i] == f_serialized_simple_splitter || i == serialized.used) { if (locations->used + width >= locations->size) { - f_resize_string_locations(status, (*locations), locations->size + f_serialized_default_allocation_step); + f_macro_strings_string_locations_resize(status, (*locations), locations->size + f_serialized_default_allocation_step); if (f_status_is_error(status)) return status; } diff --git a/level_1/fl_strings/c/strings.c b/level_1/fl_strings/c/strings.c index 6413553..7416fad 100644 --- a/level_1/fl_strings/c/strings.c +++ b/level_1/fl_strings/c/strings.c @@ -20,10 +20,10 @@ extern "C" { f_status status = f_none; if (result == 0) { - f_new_dynamic_string(status, (*result), size); + f_macro_string_dynamic_new(status, (*result), size); } else { - f_resize_dynamic_string(status, (*result), size); + f_macro_string_dynamic_resize(status, (*result), size); } if (f_status_is_error(status)) { diff --git a/level_1/fl_utf/c/utf.c b/level_1/fl_utf/c/utf.c index 1afe76b..e9415a3 100644 --- a/level_1/fl_utf/c/utf.c +++ b/level_1/fl_utf/c/utf.c @@ -20,10 +20,10 @@ extern "C" { f_status status = f_none; if (result == 0) { - f_new_utf_string_dynamic(status, (*result), size); + f_macro_utf_string_new_dynamic(status, (*result), size); } else { - f_resize_utf_string_dynamic(status, (*result), size); + f_macro_utf_string_dynamic_resize(status, (*result), size); } if (f_status_is_error(status)) { diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index afa2807..5be2f94 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -31,7 +31,7 @@ extern "C" { name_size = strnlen(last_slash, PATH_MAX); if (name_size > 1) { - f_new_string(status, program_name, name_size + 1); + f_macro_strings_string_new(status, program_name, name_size + 1); if (f_status_is_error(status)) return status; @@ -51,15 +51,15 @@ extern "C" { } for (f_string_length i = 0; i < arguments.used; i++) { - f_new_string(status, fixed_arguments[i + 1], arguments.array[i].used + 1); + f_macro_strings_string_new(status, fixed_arguments[i + 1], arguments.array[i].used + 1); if (f_status_is_error(status)) { f_status status2 = f_none; - if (name_size > 0) f_delete_string(status, program_name, name_size); + if (name_size > 0) f_macro_strings_string_delete(status, program_name, name_size); for (f_string_length j = 0; j < i; j++) { - f_delete_string(status2, fixed_arguments[i + 1], arguments.array[j].used + 1); + f_macro_strings_string_delete(status2, fixed_arguments[i + 1], arguments.array[j].used + 1); } return status; @@ -80,10 +80,10 @@ extern "C" { if (process_id < 0) { f_status status2 = f_none; - if (name_size > 0) f_delete_string(status, program_name, name_size); + if (name_size > 0) f_macro_strings_string_delete(status, program_name, name_size); for (f_string_length i = 0; i < arguments.used; i++) { - f_delete_string(status2, fixed_arguments[i + 1], arguments.array[i].used + 1); + f_macro_strings_string_delete(status2, fixed_arguments[i + 1], arguments.array[i].used + 1); } // for return f_status_set_error(f_fork_failed); @@ -100,13 +100,13 @@ extern "C" { // have the parent wait for the child process to finish waitpid(process_id, results, 0); - if (name_size > 0) f_delete_string(status, program_name, name_size); + if (name_size > 0) f_macro_strings_string_delete(status, program_name, name_size); { f_status status2 = f_none; for (f_string_length i = 0; i < arguments.used; i++) { - f_delete_string(status2, fixed_arguments[i + 1], arguments.array[i].used + 1); + f_macro_strings_string_delete(status2, fixed_arguments[i + 1], arguments.array[i].used + 1); } // for } @@ -133,13 +133,13 @@ extern "C" { f_status status = f_none; for (f_string_length i = 0; i < arguments.used; i++) { - f_new_string(status, fixed_arguments[i + 1], arguments.array[i].used + 1); + f_macro_strings_string_new(status, fixed_arguments[i + 1], arguments.array[i].used + 1); if (f_status_is_error(status)) { f_status status2 = f_none; for (f_string_length j = 0; j < i; j++) { - f_delete_string(status2, fixed_arguments[i + 1], arguments.array[j].used + 1); + f_macro_strings_string_delete(status2, fixed_arguments[i + 1], arguments.array[j].used + 1); } return status; @@ -161,7 +161,7 @@ extern "C" { f_status status2 = f_none; for (f_string_length i = 0; i < arguments.used; i++) { - f_delete_string(status2, fixed_arguments[i + 1], arguments.array[i].used + 1); + f_macro_strings_string_delete(status2, fixed_arguments[i + 1], arguments.array[i].used + 1); } // for return f_status_set_error(f_fork_failed); @@ -182,7 +182,7 @@ extern "C" { f_status status2 = f_none; for (f_string_length i = 0; i < arguments.used; i++) { - f_delete_string(status2, fixed_arguments[i + 1], arguments.array[i].used + 1); + f_macro_strings_string_delete(status2, fixed_arguments[i + 1], arguments.array[i].used + 1); } } diff --git a/level_2/fll_fss/c/fss_basic.c b/level_2/fll_fss/c/fss_basic.c index 4bf3b81..6d18ed2 100644 --- a/level_2/fll_fss/c/fss_basic.c +++ b/level_2/fll_fss/c/fss_basic.c @@ -18,13 +18,13 @@ extern "C" { do { if (objects->used >= objects->size) { - f_resize_fss_objects(status, (*objects), objects->used + f_fss_default_allocation_step); + f_macro_fss_objects_resize(status, (*objects), objects->used + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; } - f_resize_fss_contents(status, (*contents), contents->used + f_fss_default_allocation_step); + f_macro_fss_contents_resize(status, (*contents), contents->used + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; @@ -41,7 +41,7 @@ extern "C" { if (contents->array[contents->used].used >= contents->array[contents->used].size) { f_status status = f_none; - f_resize_fss_content(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); + f_macro_fss_content_resize(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; @@ -81,7 +81,7 @@ extern "C" { if (contents->array[contents->used].used >= contents->array[contents->used].size) { f_status status = f_none; - f_resize_fss_content(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); + f_macro_fss_content_resize(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; @@ -165,7 +165,7 @@ extern "C" { } else { if (buffer->used >= buffer->size) { - f_resize_dynamic_string(status, (*buffer), buffer->size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), buffer->size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } diff --git a/level_2/fll_fss/c/fss_basic_list.c b/level_2/fll_fss/c/fss_basic_list.c index f1092f4..601939a 100644 --- a/level_2/fll_fss/c/fss_basic_list.c +++ b/level_2/fll_fss/c/fss_basic_list.c @@ -18,13 +18,13 @@ extern "C" { do { if (objects->used >= objects->size) { - f_resize_fss_objects(status, (*objects), objects->used + f_fss_default_allocation_step); + f_macro_fss_objects_resize(status, (*objects), objects->used + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; } - f_resize_fss_contents(status, (*contents), contents->used + f_fss_default_allocation_step); + f_macro_fss_contents_resize(status, (*contents), contents->used + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; @@ -41,7 +41,7 @@ extern "C" { if (contents->array[contents->used].used >= contents->array[contents->used].size) { f_status status = f_none; - f_resize_fss_content(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); + f_macro_fss_content_resize(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; @@ -81,7 +81,7 @@ extern "C" { if (contents->array[contents->used].used >= contents->array[contents->used].size) { f_status status = f_none; - f_resize_fss_content(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); + f_macro_fss_content_resize(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; @@ -165,7 +165,7 @@ extern "C" { } else { if (buffer->used >= buffer->size) { - f_resize_dynamic_string(status, (*buffer), buffer->size + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, (*buffer), buffer->size + f_fss_default_allocation_step_string); if (f_status_is_error(status)) return status; } diff --git a/level_2/fll_fss/c/fss_extended.c b/level_2/fll_fss/c/fss_extended.c index 6a73491..862d67b 100644 --- a/level_2/fll_fss/c/fss_extended.c +++ b/level_2/fll_fss/c/fss_extended.c @@ -18,13 +18,13 @@ extern "C" { do { if (objects->used >= objects->size) { - f_resize_fss_objects(status, (*objects), objects->used + f_fss_default_allocation_step); + f_macro_fss_objects_resize(status, (*objects), objects->used + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; } - f_resize_fss_contents(status, (*contents), contents->used + f_fss_default_allocation_step); + f_macro_fss_contents_resize(status, (*contents), contents->used + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; @@ -41,7 +41,7 @@ extern "C" { if (contents->array[contents->used].used >= contents->array[contents->used].size) { f_status status = f_none; - f_resize_fss_content(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); + f_macro_fss_content_resize(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; @@ -81,7 +81,7 @@ extern "C" { if (contents->array[contents->used].used >= contents->array[contents->used].size) { f_status status = f_none; - f_resize_fss_content(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); + f_macro_fss_content_resize(status, contents->array[contents->used], contents->array[contents->used].size + f_fss_default_allocation_step); if (f_status_is_error(status)) { return status; diff --git a/level_3/firewall/c/firewall.c b/level_3/firewall/c/firewall.c index 1b16173..8fb7f39 100644 --- a/level_3/firewall/c/firewall.c +++ b/level_3/firewall/c/firewall.c @@ -256,7 +256,7 @@ extern "C" { } // for } - f_resize_dynamic_strings(status, arguments, 7); + f_macro_string_dynamics_resize(status, arguments, 7); if (f_status_is_error(status)) { fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory"); @@ -386,7 +386,7 @@ extern "C" { arguments.array[5].used = 0; arguments.array[6].used = 0; - f_delete_dynamic_strings(status, arguments); + f_macro_string_dynamics_delete(status, arguments); firewall_delete_local_data(&local); firewall_delete_data(data); return status; @@ -602,7 +602,7 @@ extern "C" { { f_dynamic_string file_path = f_dynamic_string_initialize; - f_resize_dynamic_string(status, file_path, network_path_length + data->devices.array[i].used + firewall_file_suffix_length + 1); + f_macro_string_dynamic_resize(status, file_path, network_path_length + data->devices.array[i].used + firewall_file_suffix_length + 1); if (f_status_is_error(status)) { fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "CRITICAL ERROR: unable to allocate memory."); @@ -620,7 +620,7 @@ extern "C" { status = firewall_buffer_rules(file_path.string, f_true, &local, data); - f_delete_dynamic_string(status2, file_path); + f_macro_string_dynamic_delete(status2, file_path); } if (f_status_is_error(status)) { @@ -731,13 +731,13 @@ extern "C" { f_string_length i = 0; while (i < firewall_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_dynamic_strings(status, data->chains); - f_delete_string_lengths(status, data->remaining); - f_delete_dynamic_strings(status, data->devices); + f_macro_string_dynamics_delete(status, data->chains); + f_macro_strings_string_lengths_delete(status, data->remaining); + f_macro_string_dynamics_delete(status, data->devices); fl_delete_color_context(status, data->context); diff --git a/level_3/firewall/c/private-firewall.c b/level_3/firewall/c/private-firewall.c index bbcf22f..0ad51bf 100644 --- a/level_3/firewall/c/private-firewall.c +++ b/level_3/firewall/c/private-firewall.c @@ -38,10 +38,10 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const } else { if (data.devices.array[local.device].used > 0) { - f_new_dynamic_string(status, device, data.devices.array[local.device].used); + f_macro_string_dynamic_new(status, device, data.devices.array[local.device].used); if (f_status_is_error(status)) { - f_delete_dynamic_string(status2, device); + f_macro_string_dynamic_delete(status2, device); return status; } @@ -63,7 +63,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const is_ip_list = f_false; ip_list_direction = f_false; - f_delete_dynamic_string(status2, ip_list); + f_macro_string_dynamic_delete(status2, ip_list); // process chain rule if (length >= firewall_chain_length && fl_compare_strings(local.buffer.string + local.rule_objects.array[i].start, (f_string) firewall_chain, length, firewall_chain_length) == f_equal_to) { @@ -133,14 +133,14 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const invalid = f_true; } else if (length >= firewall_device_all_length && fl_compare_strings(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string) firewall_device_all, length, firewall_device_all_length) == f_equal_to) { - f_delete_dynamic_string(status, device); + f_macro_string_dynamic_delete(status, device); device_all = f_true; continue; } else if (length >= firewall_device_this_length && fl_compare_strings(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string) firewall_device_this, length, firewall_device_this_length) == f_equal_to) { if (data.devices.array[local.device].used > 0) { if (data.devices.array[local.device].used > device.size) { - f_resize_dynamic_string(status, device, data.devices.array[local.device].used); + f_macro_string_dynamic_resize(status, device, data.devices.array[local.device].used); if (f_status_is_error(status)) break; } @@ -150,7 +150,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const device.used = data.devices.array[local.device].used; } else { - f_delete_dynamic_string(status, device); + f_macro_string_dynamic_delete(status, device); } device_all = f_false; @@ -160,7 +160,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const if (!invalid) { if (length > 0) { if (length > device.size) { - f_resize_dynamic_string(status, device, length); + f_macro_string_dynamic_resize(status, device, length); if (f_status_is_error(status)) break; } @@ -169,7 +169,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const device.used = length; } else { - f_delete_dynamic_string(status, device); + f_macro_string_dynamic_delete(status, device); } device_all = f_false; @@ -227,8 +227,8 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const use_protocol = f_false; } else if (length > 0) { - f_delete_dynamic_string(status, protocol); - f_new_dynamic_string(status, protocol, length); + f_macro_string_dynamic_delete(status, protocol); + f_macro_string_dynamic_new(status, protocol, length); if (f_status_is_error(status)) break; @@ -315,8 +315,8 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const for (r = repeat; r > 0; r--) { // first add the program name - f_delete_dynamic_strings(status, arguments); - f_new_dynamic_strings(status, arguments, firewall_default_allocation_step); + f_macro_string_dynamics_delete(status, arguments); + f_macro_string_dynamics_new(status, arguments, firewall_default_allocation_step); if (f_status_is_error(status)) break; @@ -331,14 +331,14 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const } } - f_delete_dynamic_string(status, argument); + f_macro_string_dynamic_delete(status, argument); if (f_status_is_error(status)) break; // process the action when a non-none chain is specified. if (chain != firewall_chain_none_id && action != firewall_action_none_id) { if (action == firewall_action_append_id) { - f_new_dynamic_string(status, argument, firewall_action_append_command_length); + f_macro_string_dynamic_new(status, argument, firewall_action_append_command_length); if (f_status_is_error(status)) break; @@ -346,7 +346,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const argument.used = firewall_action_append_command_length; } else if (action == firewall_action_insert_id) { - f_new_dynamic_string(status, argument, firewall_action_insert_command_length); + f_macro_string_dynamic_new(status, argument, firewall_action_insert_command_length); if (f_status_is_error(status)) break; @@ -354,7 +354,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const argument.used = firewall_action_insert_command_length; } else if (action == firewall_action_policy_id) { - f_new_dynamic_string(status, argument, firewall_action_policy_command_length); + f_macro_string_dynamic_new(status, argument, firewall_action_policy_command_length); if (f_status_is_error(status)) break; @@ -365,14 +365,14 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const if (argument.used > 0) { firewall_macro_append_argument_to_arguments(status, arguments, argument) if (f_status_is_error(status)) { - f_delete_dynamic_string(status2, argument); + f_macro_string_dynamic_delete(status2, argument); break; } // process the chain, which is required by the action. if (chain == firewall_chain_custom_id) { if (data.chains.array[local.chain_ids.array[local.chain]].used > 0) { - f_new_dynamic_string(status, argument, data.chains.array[local.chain_ids.array[local.chain]].used); + f_macro_string_dynamic_new(status, argument, data.chains.array[local.chain_ids.array[local.chain]].used); if (f_status_is_error(status)) break; @@ -381,7 +381,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const } } else if (chain == firewall_chain_forward_id) { - f_new_dynamic_string(status, argument, firewall_chain_forward_length); + f_macro_string_dynamic_new(status, argument, firewall_chain_forward_length); if (f_status_is_error(status)) break; @@ -389,7 +389,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const argument.used = firewall_chain_forward_length; } else if (chain == firewall_chain_postrouting_id) { - f_new_dynamic_string(status, argument, firewall_chain_postrouting_length); + f_macro_string_dynamic_new(status, argument, firewall_chain_postrouting_length); if (f_status_is_error(status)) break; @@ -397,7 +397,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const argument.used += firewall_chain_postrouting_length; } else if (chain == firewall_chain_prerouting_id) { - f_new_dynamic_string(status, argument, firewall_chain_prerouting_length); + f_macro_string_dynamic_new(status, argument, firewall_chain_prerouting_length); if (f_status_is_error(status)) break; @@ -405,7 +405,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const argument.used = firewall_chain_prerouting_length; } else if (chain == firewall_chain_input_id) { - f_new_dynamic_string(status, argument, firewall_chain_input_length); + f_macro_string_dynamic_new(status, argument, firewall_chain_input_length); if (f_status_is_error(status)) break; @@ -413,7 +413,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const argument.used = firewall_chain_input_length; } else if (chain == firewall_chain_output_id) { - f_new_dynamic_string(status, argument, firewall_chain_output_length); + f_macro_string_dynamic_new(status, argument, firewall_chain_output_length); if (f_status_is_error(status)) break; @@ -434,14 +434,14 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const if (device.used > 0 && (direction == firewall_direction_input_id || direction == firewall_direction_output_id)) { if (length < firewall_device_all_length || fl_compare_strings(local.buffer.string + local.rule_contents.array[i].array[0].start, (f_string) firewall_device_all, length, firewall_device_all_length) == f_not_equal_to) { if (direction == firewall_direction_input_id) { - f_new_dynamic_string(status, argument, firewall_device_input_command_length); + f_macro_string_dynamic_new(status, argument, firewall_device_input_command_length); if (f_status_is_error(status)) break; firewall_macro_concat_string(argument.string, firewall_device_input_command, firewall_device_input_command_length); argument.used = firewall_device_input_command_length; } else if (direction == firewall_direction_output_id) { - f_new_dynamic_string(status, argument, firewall_device_output_command_length); + f_macro_string_dynamic_new(status, argument, firewall_device_output_command_length); if (f_status_is_error(status)) break; firewall_macro_concat_string(argument.string, firewall_device_output_command, firewall_device_output_command_length); @@ -458,7 +458,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const // add the device. if (device.used > 0) { - f_new_dynamic_string(status, argument, device.used); + f_macro_string_dynamic_new(status, argument, device.used); if (f_status_is_error(status)) break; @@ -473,7 +473,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const } if (use_protocol) { - f_new_dynamic_string(status, argument, firewall_protocol_command_length); + f_macro_string_dynamic_new(status, argument, firewall_protocol_command_length); if (f_status_is_error(status)) break; @@ -486,7 +486,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const } if (protocol.used > 0) { - f_new_dynamic_string(status, argument, protocol.used); + f_macro_string_dynamic_new(status, argument, protocol.used); if (f_status_is_error(status)) break; @@ -511,7 +511,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const length = firewall_macro_structure_size(local.rule_contents.array[i], subcounter); if (length > 0) { - f_new_dynamic_string(status, ip_list, length); + f_macro_string_dynamic_new(status, ip_list, length); if (f_status_is_error(status)) { // prevent the loop below from being processed. @@ -530,7 +530,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const length = firewall_macro_structure_size(local.rule_contents.array[i], subcounter); if (length > 0) { - f_new_dynamic_string(status, argument, length); + f_macro_string_dynamic_new(status, argument, length); if (f_status_is_error(status)) break; @@ -568,7 +568,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const f_fss_objects basic_objects = f_fss_objects_initialize; f_fss_contents basic_contents = f_fss_objects_initialize; - f_new_dynamic_string(status, file_path, network_path_length + ip_list.used + firewall_default_allocation_step); + f_macro_string_dynamic_new(status, file_path, network_path_length + ip_list.used + firewall_default_allocation_step); if (status == f_none) { firewall_macro_concat_string(file_path.string, network_path, network_path_length); @@ -680,7 +680,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const f_dynamic_string ip_list_action = f_dynamic_string_initialize; if (ip_list_direction) { - f_resize_dynamic_string(status, ip_list_action, firewall_ip_list_destination_action_length); + f_macro_string_dynamic_resize(status, ip_list_action, firewall_ip_list_destination_action_length); if (f_status_is_error(status)) break; @@ -688,7 +688,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const ip_list_action.used = firewall_ip_list_destination_action_length; } else { - f_resize_dynamic_string(status, ip_list_action, firewall_ip_list_source_action_length); + f_macro_string_dynamic_resize(status, ip_list_action, firewall_ip_list_source_action_length); if (f_status_is_error(status)) break; @@ -698,20 +698,20 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const status = f_none; if (arguments.used + 2 > arguments.size) { - f_resize_dynamic_strings(status, arguments, arguments.size + 2); + f_macro_string_dynamics_resize(status, arguments, arguments.size + 2); } if (f_status_is_error(status)) { fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "CRITICAL ERROR: unable to allocate memory"); - f_delete_dynamic_string(status2, ip_list_action); + f_macro_string_dynamic_delete(status2, ip_list_action); } else { f_dynamic_string ip_argument = f_dynamic_string_initialize; firewall_macro_append_argument_to_arguments(status, arguments, ip_list_action) if (f_status_is_error(status)) { - f_delete_dynamic_string(status2, ip_argument); + f_macro_string_dynamic_delete(status2, ip_argument); break; } @@ -719,7 +719,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const for (; buffer_counter < basic_objects.used; buffer_counter++) { ip_length = firewall_macro_structure_size(basic_objects, buffer_counter); - f_new_dynamic_string(status, ip_argument, ip_length); + f_macro_string_dynamic_new(status, ip_argument, ip_length); if (f_status_is_error(status)) { fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "CRITICAL ERROR: unable to allocate memory"); @@ -764,7 +764,7 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const fprintf(f_standard_error, "\n"); // remove ip_argument from arguments string. - f_delete_dynamic_string(status2, arguments.array[arguments.used]); + f_macro_string_dynamic_delete(status2, arguments.array[arguments.used]); arguments.used--; break; @@ -773,31 +773,31 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "INTERNAL ERROR: Invalid parameter when calling fll_execute_program()"); // remove ip_argument from arguments string. - f_delete_dynamic_string(status2, arguments.array[arguments.used]); + f_macro_string_dynamic_delete(status2, arguments.array[arguments.used]); arguments.used--; break; } // remove ip_argument from arguments string. - f_delete_dynamic_string(status2, arguments.array[arguments.used]); + f_macro_string_dynamic_delete(status2, arguments.array[arguments.used]); arguments.used--; } // for - f_delete_dynamic_string(status2, ip_argument); + f_macro_string_dynamic_delete(status2, ip_argument); // remove ip_list_action from arguments string. - f_delete_dynamic_string(status2, arguments.array[arguments.used]); + f_macro_string_dynamic_delete(status2, arguments.array[arguments.used]); arguments.used--; } } } } - f_delete_dynamic_string(status2, local_buffer); - f_delete_dynamic_string(status2, file_path); - f_delete_fss_objects(status2, basic_objects); - f_delete_fss_contents(status2, basic_contents); + f_macro_string_dynamic_delete(status2, local_buffer); + f_macro_string_dynamic_delete(status2, file_path); + f_macro_fss_objects_delete(status2, basic_objects); + f_macro_fss_contents_delete(status2, basic_contents); if (status == f_failure || status == f_invalid_parameter) break; } @@ -843,11 +843,11 @@ f_return_status firewall_perform_commands(const firewall_local_data local, const } // for } // for - f_delete_dynamic_string(status2, ip_list); - f_delete_dynamic_string(status2, argument); - f_delete_dynamic_strings(status2, arguments); - f_delete_dynamic_string(status2, device); - f_delete_dynamic_string(status2, protocol); + f_macro_string_dynamic_delete(status2, ip_list); + f_macro_string_dynamic_delete(status2, argument); + f_macro_string_dynamics_delete(status2, arguments); + f_macro_string_dynamic_delete(status2, device); + f_macro_string_dynamic_delete(status2, protocol); return status; } @@ -870,23 +870,23 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains *reserved f_dynamic_string fixed_string = f_dynamic_string_initialize; - f_delete_array_lengths(status, local->chain_ids); - f_new_array_lengths(status, local->chain_ids, local->chain_objects.used); + f_macro_types_array_lengths_delete(status, local->chain_ids); + f_macro_types_array_lengths_new(status, local->chain_ids, local->chain_objects.used); if (f_status_is_error(status)) { return status; } - f_new_dynamic_strings(status, arguments, 2); + f_macro_string_dynamics_new(status, arguments, 2); if (f_status_is_error(status)) { return status; } - f_new_dynamic_string(status, arguments.array[0], firewall_chain_create_command_length); + f_macro_string_dynamic_new(status, arguments.array[0], firewall_chain_create_command_length); if (f_status_is_error(status)) { - f_delete_dynamic_strings(status2, arguments); + f_macro_string_dynamics_delete(status2, arguments); return status; } @@ -895,11 +895,11 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains *reserved arguments.array[0].used = firewall_chain_create_command_length; - f_new_dynamic_string(status, arguments.array[1], firewall_default_allocation_step); + f_macro_string_dynamic_new(status, arguments.array[1], firewall_default_allocation_step); if (f_status_is_error(status)) { arguments.used = 1; - f_delete_dynamic_strings(status2, arguments); + f_macro_string_dynamics_delete(status2, arguments); return status; } @@ -976,10 +976,10 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains *reserved if (new_chain) { if (data->chains.used >= data->chains.size) { - f_resize_dynamic_strings(status, data->chains, data->chains.used + firewall_default_allocation_step); + f_macro_string_dynamics_resize(status, data->chains, data->chains.used + firewall_default_allocation_step); if (f_status_is_error(status)) { - f_delete_dynamic_strings(status2, arguments); + f_macro_string_dynamics_delete(status2, arguments); return status; } @@ -990,19 +990,19 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains *reserved arguments.array[1].used = 0; if (length > arguments.array[1].size) { - f_resize_dynamic_string(status, arguments.array[1], length); + f_macro_string_dynamic_resize(status, arguments.array[1], length); if (f_status_is_error(status)) { - f_delete_dynamic_strings(status2, arguments); + f_macro_string_dynamics_delete(status2, arguments); return status; } } - f_new_dynamic_string(status, data->chains.array[data->chains.used], length); + f_macro_string_dynamic_new(status, data->chains.array[data->chains.used], length); if (f_status_is_error(status)) { - f_delete_dynamic_strings(status2, arguments); + f_macro_string_dynamics_delete(status2, arguments); return status; } @@ -1116,7 +1116,7 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains *reserved fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fll_execute_program()", f_status_set_error(status)); } - f_delete_dynamic_strings(status2, arguments); + f_macro_string_dynamics_delete(status2, arguments); return status; } } @@ -1127,7 +1127,7 @@ f_return_status firewall_create_custom_chains(firewall_reserved_chains *reserved i++; } // while - f_delete_dynamic_strings(status2, arguments); + f_macro_string_dynamics_delete(status2, arguments); return status; } @@ -1458,14 +1458,14 @@ f_return_status firewall_process_rules(f_string_location *input, firewall_local_ fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling firewall_perform_commands().", f_status_set_error(status)); } - f_delete_fss_objects(status2, local->rule_objects); - f_delete_fss_contents(status2, local->rule_contents); + f_macro_fss_objects_delete(status2, local->rule_objects); + f_macro_fss_contents_delete(status2, local->rule_contents); return status; } } - f_delete_fss_objects(status2, local->rule_objects); - f_delete_fss_contents(status2, local->rule_contents); + f_macro_fss_objects_delete(status2, local->rule_objects); + f_macro_fss_contents_delete(status2, local->rule_contents); return status; } @@ -1484,12 +1484,12 @@ f_return_status firewall_delete_local_data(firewall_local_data *local) { local->device = 0; local->chain = 0; - f_delete_dynamic_string(status, local->buffer); - f_delete_array_lengths(status, local->chain_ids); - f_delete_fss_objects(status, local->chain_objects); - f_delete_fss_contents(status, local->chain_contents); - f_delete_fss_objects(status, local->rule_objects); - f_delete_fss_contents(status, local->rule_contents); + f_macro_string_dynamic_delete(status, local->buffer); + f_macro_types_array_lengths_delete(status, local->chain_ids); + f_macro_fss_objects_delete(status, local->chain_objects); + f_macro_fss_contents_delete(status, local->chain_contents); + f_macro_fss_objects_delete(status, local->rule_objects); + f_macro_fss_contents_delete(status, local->rule_contents); return f_none; } diff --git a/level_3/firewall/c/private-firewall.h b/level_3/firewall/c/private-firewall.h index 4553c39..8341f99 100644 --- a/level_3/firewall/c/private-firewall.h +++ b/level_3/firewall/c/private-firewall.h @@ -69,9 +69,9 @@ typedef struct { } #define firewall_macro_delete_fss_buffers(status, buffer, objects, contents) \ - f_delete_dynamic_string(status, buffer); \ - f_delete_fss_objects(status, objects); \ - f_delete_fss_contents(status, contents); + f_macro_string_dynamic_delete(status, buffer); \ + f_macro_fss_objects_delete(status, objects); \ + f_macro_fss_contents_delete(status, contents); #define firewall_macro_concat_string(destination, source, length) \ memcpy((void *)(destination), source, sizeof(char) * length); @@ -91,7 +91,7 @@ typedef struct { // TODO: also report: fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "CRITICAL ERROR: unable to allocate memory"); #define firewall_macro_append_argument_to_arguments(status, arguments, argument) \ if (arguments.used >= arguments.size) { \ - f_resize_dynamic_strings(status, arguments, arguments.used + firewall_default_allocation_step); \ + f_macro_string_dynamics_resize(status, arguments, arguments.used + firewall_default_allocation_step); \ \ if (f_status_is_error(status)) break; \ } \ diff --git a/level_3/fss_basic_list_read/c/fss_basic_list_read.c b/level_3/fss_basic_list_read/c/fss_basic_list_read.c index ae0c364..c2240d7 100644 --- a/level_3/fss_basic_list_read/c/fss_basic_list_read.c +++ b/level_3/fss_basic_list_read/c/fss_basic_list_read.c @@ -212,9 +212,9 @@ extern "C" { } // clear buffers before continuing - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); } for (; counter < data->remaining.used; counter++) { @@ -301,9 +301,9 @@ extern "C" { } // clear buffers before repeating the loop - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); } // for } else { @@ -354,9 +354,9 @@ extern "C" { } else if (status == f_no_data_on_stop || status == f_no_data_on_eos) { // clear buffers, then attempt the next file - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); return f_status_set_warning(status); } @@ -606,14 +606,14 @@ extern "C" { f_string_length i = 0; while (i < fss_basic_list_read_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_fss_contents(status, data->contents); - f_delete_fss_objects(status, data->objects); - f_delete_dynamic_string(status, data->buffer); - f_delete_string_lengths(status, data->remaining); + f_macro_fss_contents_delete(status, data->contents); + f_macro_fss_objects_delete(status, data->objects); + f_macro_string_dynamic_delete(status, data->buffer); + f_macro_strings_string_lengths_delete(status, data->remaining); fl_delete_color_context(status, data->context); diff --git a/level_3/fss_basic_list_write/c/fss_basic_list_write.c b/level_3/fss_basic_list_write/c/fss_basic_list_write.c index c005b50..e631927 100644 --- a/level_3/fss_basic_list_write/c/fss_basic_list_write.c +++ b/level_3/fss_basic_list_write/c/fss_basic_list_write.c @@ -172,7 +172,7 @@ extern "C" { fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", f_status_set_error(status)); } - f_delete_dynamic_string(status2, input); + f_macro_string_dynamic_delete(status2, input); fss_basic_list_write_delete_data(data); return f_status_set_error(status); } @@ -195,7 +195,7 @@ extern "C" { } } - f_delete_dynamic_string(status, input); + f_macro_string_dynamic_delete(status, input); } else if (data->parameters[fss_basic_list_write_parameter_string].result == f_console_result_additional) { f_dynamic_string input = f_dynamic_string_initialize; @@ -291,11 +291,11 @@ extern "C" { f_string_length i = 0; while (i < fss_basic_list_write_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_string_lengths(status, data->remaining); + f_macro_strings_string_lengths_delete(status, data->remaining); fl_delete_color_context(status, data->context); return f_none; diff --git a/level_3/fss_basic_read/c/fss_basic_read.c b/level_3/fss_basic_read/c/fss_basic_read.c index 75b8f5c..81223c9 100644 --- a/level_3/fss_basic_read/c/fss_basic_read.c +++ b/level_3/fss_basic_read/c/fss_basic_read.c @@ -204,9 +204,9 @@ extern "C" { } // clear buffers before continuing - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); } if (data->remaining.used > 0) { @@ -294,9 +294,9 @@ extern "C" { } // clear buffers before repeating the loop - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); } // for } } @@ -348,9 +348,9 @@ extern "C" { } else if (status == f_no_data_on_stop || status == f_no_data_on_eos) { // clear buffers, then attempt the next file - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); return f_status_set_warning(status); } @@ -495,14 +495,14 @@ extern "C" { f_string_length i = 0; while (i < fss_basic_read_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_fss_contents(status, data->contents); - f_delete_fss_objects(status, data->objects); - f_delete_dynamic_string(status, data->buffer); - f_delete_string_lengths(status, data->remaining); + f_macro_fss_contents_delete(status, data->contents); + f_macro_fss_objects_delete(status, data->objects); + f_macro_string_dynamic_delete(status, data->buffer); + f_macro_strings_string_lengths_delete(status, data->remaining); fl_delete_color_context(status, data->context); diff --git a/level_3/fss_basic_write/c/fss_basic_write.c b/level_3/fss_basic_write/c/fss_basic_write.c index c710c30..f943c598 100644 --- a/level_3/fss_basic_write/c/fss_basic_write.c +++ b/level_3/fss_basic_write/c/fss_basic_write.c @@ -172,7 +172,7 @@ extern "C" { fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", f_status_set_error(status)); } - f_delete_dynamic_string(status2, input); + f_macro_string_dynamic_delete(status2, input); fss_basic_write_delete_data(data); return f_status_set_error(status); } @@ -195,7 +195,7 @@ extern "C" { } } - f_delete_dynamic_string(status, input); + f_macro_string_dynamic_delete(status, input); } else if (data->parameters[fss_basic_write_parameter_string].result == f_console_result_additional) { f_dynamic_string input = f_dynamic_string_initialize; @@ -291,11 +291,11 @@ extern "C" { f_string_length i = 0; while (i < fss_basic_write_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_string_lengths(status, data->remaining); + f_macro_strings_string_lengths_delete(status, data->remaining); fl_delete_color_context(status, data->context); return f_none; diff --git a/level_3/fss_extended_read/c/fss_extended_read.c b/level_3/fss_extended_read/c/fss_extended_read.c index 31be561..083f464 100644 --- a/level_3/fss_extended_read/c/fss_extended_read.c +++ b/level_3/fss_extended_read/c/fss_extended_read.c @@ -211,9 +211,9 @@ extern "C" { } // clear buffers before continuing - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); } for (; counter < data->remaining.used; counter++) { @@ -300,9 +300,9 @@ extern "C" { } // clear buffers before repeating the loop - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); } // for } else { @@ -353,9 +353,9 @@ extern "C" { } else if (status == f_no_data_on_stop || status == f_no_data_on_eos) { // clear buffers, then attempt the next file - f_delete_fss_contents(status2, data->contents); - f_delete_fss_objects(status2, data->objects); - f_delete_dynamic_string(status2, data->buffer); + f_macro_fss_contents_delete(status2, data->contents); + f_macro_fss_objects_delete(status2, data->objects); + f_macro_string_dynamic_delete(status2, data->buffer); return f_status_set_warning(status); } @@ -503,14 +503,14 @@ extern "C" { f_string_length i = 0; while (i < fss_extended_read_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_fss_contents(status, data->contents); - f_delete_fss_objects(status, data->objects); - f_delete_dynamic_string(status, data->buffer); - f_delete_string_lengths(status, data->remaining); + f_macro_fss_contents_delete(status, data->contents); + f_macro_fss_objects_delete(status, data->objects); + f_macro_string_dynamic_delete(status, data->buffer); + f_macro_strings_string_lengths_delete(status, data->remaining); fl_delete_color_context(status, data->context); diff --git a/level_3/fss_extended_write/c/fss_extended_write.c b/level_3/fss_extended_write/c/fss_extended_write.c index 6ce36e3..4650707 100644 --- a/level_3/fss_extended_write/c/fss_extended_write.c +++ b/level_3/fss_extended_write/c/fss_extended_write.c @@ -179,7 +179,7 @@ extern "C" { fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling f_file_open()", f_status_set_error(status)); } - f_delete_dynamic_string(status2, input); + f_macro_string_dynamic_delete(status2, input); fss_extended_write_delete_data(data); return f_status_set_error(status); } @@ -203,7 +203,7 @@ extern "C" { if (data->parameters[fss_extended_write_parameter_partial].result == f_console_result_none) { if (buffer.used >= buffer.size) { - f_resize_dynamic_string(status, buffer, buffer.used + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, buffer, buffer.used + f_fss_default_allocation_step_string); if (f_status_is_error(status)) { return status; @@ -215,7 +215,7 @@ extern "C" { } } - f_delete_dynamic_string(status, input); + f_macro_string_dynamic_delete(status, input); } else if (data->parameters[fss_extended_write_parameter_string].result == f_console_result_additional) { f_dynamic_string input = f_dynamic_string_initialize; @@ -254,7 +254,7 @@ extern "C" { if (data->parameters[fss_extended_write_parameter_partial].result == f_console_result_none) { if (buffer.used >= buffer.size) { - f_resize_dynamic_string(status, buffer, buffer.used + f_fss_default_allocation_step_string); + f_macro_string_dynamic_resize(status, buffer, buffer.used + f_fss_default_allocation_step_string); if (f_status_is_error(status)) { return status; @@ -336,11 +336,11 @@ extern "C" { f_string_length i = 0; while (i < fss_extended_write_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_string_lengths(status, data->remaining); + f_macro_strings_string_lengths_delete(status, data->remaining); fl_delete_color_context(status, data->context); return f_none; diff --git a/level_3/fss_status_code/c/fss_status_code.c b/level_3/fss_status_code/c/fss_status_code.c index a66a5eb..75afb67 100644 --- a/level_3/fss_status_code/c/fss_status_code.c +++ b/level_3/fss_status_code/c/fss_status_code.c @@ -356,11 +356,11 @@ extern "C" { f_string_length i = 0; while (i < fss_status_code_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_string_lengths(status, data->remaining); + f_macro_strings_string_lengths_delete(status, data->remaining); fl_delete_color_context(status, data->context); return f_none; diff --git a/level_3/init/c/private-init.c b/level_3/init/c/private-init.c index ef24f99..fd4d38d 100644 --- a/level_3/init/c/private-init.c +++ b/level_3/init/c/private-init.c @@ -115,14 +115,14 @@ fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling firewall_perform_commands().", f_status_set_error(status)); } - f_delete_fss_objects(status2, local->rule_objects); - f_delete_fss_contents(status2, local->rule_contents); + f_macro_fss_objects_delete(status2, local->rule_objects); + f_macro_fss_contents_delete(status2, local->rule_contents); return f_status_set_error(status); } } - f_delete_fss_objects(status2, local->rule_objects); - f_delete_fss_contents(status2, local->rule_contents); + f_macro_fss_objects_delete(status2, local->rule_objects); + f_macro_fss_contents_delete(status2, local->rule_contents); return status; } #endif // _init_rules_process_main_ @@ -325,7 +325,7 @@ if (kernel_command_line_string) { f_status status_free = f_none; - f_delete_string(status_free, kernel_command_line_string, string_length); + f_macro_strings_string_delete(status_free, kernel_command_line_string, string_length); } } @@ -505,9 +505,9 @@ fl_color_print_line(f_standard_error, argument.context.error, argument.context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling fll_fss_basic_list_read() for the file '%s'.", f_status_set_error(status), init_rule_core_file); } - f_delete_dynamic_string(buffer); - f_delete_fss_objects(objects); - f_delete_fss_contents(contents); + f_macro_string_dynamic_delete(buffer); + f_macro_fss_objects_delete(objects); + f_macro_fss_contents_delete(contents); return status; } @@ -561,8 +561,8 @@ fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occured while calling firewall_perform_commands().", f_status_set_error(status)); } - f_delete_fss_objects(status2, (*rule_objects)); - f_delete_fss_contents(status2, (*rule_contents)); + f_macro_fss_objects_delete(status2, (*rule_objects)); + f_macro_fss_contents_delete(status2, (*rule_contents)); return f_status_set_error(status); } } @@ -575,13 +575,13 @@ } } - f_delete_fss_objects(status2, (*rule_objects)); - f_delete_fss_contents(status2, (*rule_contents)); + f_macro_fss_objects_delete(status2, (*rule_objects)); + f_macro_fss_contents_delete(status2, (*rule_contents)); */ - f_delete_dynamic_string(buffer); - f_delete_fss_objects(objects); - f_delete_fss_contents(contents); + f_macro_string_dynamic_delete(buffer); + f_macro_fss_objects_delete(objects); + f_macro_fss_contents_delete(contents); return status; } #endif // _di_init_process_main_rule_ diff --git a/level_3/init/c/private-init.h b/level_3/init/c/private-init.h index e749973..29e1bc5 100644 --- a/level_3/init/c/private-init.h +++ b/level_3/init/c/private-init.h @@ -48,12 +48,12 @@ extern "C" { } #define delete_init_rule(status, rule) \ - f_delete_dynamic_string(status, rule.name); \ + f_macro_string_dynamic_delete(status, rule.name); \ if (status == f_none) { \ - f_delete_dynamic_string(status, rule.directory); \ + f_macro_string_dynamic_delete(status, rule.directory); \ } \ if (status == f_none) { \ - f_delete_dynamic_string(status, rule.file); \ + f_macro_string_dynamic_delete(status, rule.file); \ } \ if (status == f_none) { \ rule.require = 0; \ @@ -61,12 +61,12 @@ extern "C" { } #define destroy_init_rule(status, rule) \ - f_destroy_dynamic_string(status, rule.name); \ + f_macro_string_dynamic_destroy(status, rule.name); \ if (status == f_none) { \ - f_destroy_dynamic_string(status, rule.directory); \ + f_macro_string_dynamic_destroy(status, rule.directory); \ } \ if (status == f_none) { \ - f_destroy_dynamic_string(status, rule.file); \ + f_macro_string_dynamic_destroy(status, rule.file); \ } \ if (status == f_none) { \ rule.require = 0; \ @@ -84,7 +84,7 @@ extern "C" { #define init_rules_initialize { 0, 0, 0 } - #define f_delete_init_rules(status, rules) \ + #define f_init_rules_delete(status, rules) \ status = f_none; \ while (rules.size > 0) { \ --rules.size; \ @@ -94,7 +94,7 @@ extern "C" { if (status == f_none) status = f_delete((f_void_p *) & rules.array, sizeof(init_rule), rules.size); \ if (status == f_none) rules.used = 0; - #define f_destroy_init_rules(status, rules) \ + #define f_init_rules_destroy(status, rules) \ status = f_none; \ while (rules.size > 0) { \ --rules.size; \ @@ -104,7 +104,7 @@ extern "C" { if (status == f_none) status = f_destroy((f_void_p *) & rules.array, sizeof(init_rule), rules.size); \ if (status == f_none) rules.used = 0; - #define f_resize_init_rules(status, rules, new_length) \ + #define f_init_rules_resize(status, rules, new_length) \ status = f_none; \ if (new_length < rules.size) { \ f_string_length i = rules.size - new_length; \ @@ -125,7 +125,7 @@ extern "C" { if (rules.used > rules.size) rules.used = new_length; \ } - #define f_adjust_init_rules(status, rules, new_length) \ + #define f_init_rules_adjust(status, rules, new_length) \ status = f_none; \ if (new_length < rules.size) { \ f_string_length i = rules.size - new_length; \ @@ -161,13 +161,13 @@ extern "C" { } #define delete_init_category(status, category) \ - f_delete_dynamic_string(status, category.name); \ + f_macro_string_dynamic_delete(status, category.name); \ if (status == f_none) { \ delete_init_rule(status, category.last); \ } #define destroy_init_category(status, category) \ - f_destroy_dynamic_string(status, category.name); \ + f_macro_string_dynamic_destroy(status, category.name); \ if (status == f_none) { \ destroy_init_rule(status, category.last); \ } @@ -184,7 +184,7 @@ extern "C" { #define init_categorys_initialize { 0, 0, 0 } - #define f_delete_init_categorys(status, categorys) \ + #define f_init_categorys_delete(status, categorys) \ status = f_none; \ while (categorys.size > 0) { \ --categorys.size; \ @@ -194,7 +194,7 @@ extern "C" { if (status == f_none) status = f_delete((f_void_p *) & categorys.array, sizeof(init_category), categorys.size); \ if (status == f_none) categorys.used = 0; - #define f_destroy_init_categorys(status, categorys) \ + #define f_init_categorys_destroy(status, categorys) \ status = f_none; \ while (categorys.size > 0) { \ --categorys.size; \ @@ -204,7 +204,7 @@ extern "C" { if (status == f_none) status = f_destroy((f_void_p *) & categorys.array, sizeof(init_category), categorys.size); \ if (status == f_none) categorys.used = 0; - #define f_resize_init_categorys(status, categorys, new_length) \ + #define f_init_categorys_resize(status, categorys, new_length) \ status = f_none; \ if (new_length < categorys.size) { \ f_string_length i = categorys.size - new_length; \ @@ -225,7 +225,7 @@ extern "C" { if (categorys.used > categorys.size) categorys.used = new_length; \ } - #define f_adjust_init_categorys(status, categorys, new_length) \ + #define f_init_categorys_adjust(status, categorys, new_length) \ status = f_none; \ if (new_length < categorys.size) { \ f_string_length i = categorys.size - new_length; \ diff --git a/level_3/status_code/c/status_code.c b/level_3/status_code/c/status_code.c index 982162c..3e18af0 100644 --- a/level_3/status_code/c/status_code.c +++ b/level_3/status_code/c/status_code.c @@ -355,11 +355,11 @@ extern "C" { f_string_length i = 0; while (i < status_code_total_parameters) { - f_delete_string_lengths(status, data->parameters[i].additional); + f_macro_strings_string_lengths_delete(status, data->parameters[i].additional); i++; } // while - f_delete_string_lengths(status, data->remaining); + f_macro_strings_string_lengths_delete(status, data->remaining); fl_delete_color_context(status, data->context); return f_none; -- 1.8.3.1