I do not want a *_delete() and *_destroy() that doesn't provide the ability to handle a status code.
However, in practice, the *_delete() and *_destroy() macros rarely needed the status response checked.
Additional f_status variables were created only to be provided for the status parameter of the stated macros.
This is a waste.
This provides and utilizes alternative *_delete() and *_destroy() macros called *_delete_simple() and *_destroy_simple().
These simple macros do not accept or process the status code.
The resulting code is simpler and easier.
I am on the fence whether or not to throw away the *_delete() and *_destroy() macros that utilize a status parameter.
Future versions may or may not replace the *_delete() and *_destroy() with the *_delete_simple() and *_destroy_simple() macros.
Update *_delete() and *_destroy() macros as needed.
parameter_counter = needs_additional.array[0];
if (parameters.parameter[parameter_counter].additional.used >= parameters.parameter[parameter_counter].additional.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, parameters.parameter[parameter_counter].additional, parameters.parameter[parameter_counter].additional.size + f_console_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, parameters.parameter[parameter_counter].additional, parameters.parameter[parameter_counter].additional.size + f_console_default_allocation_step);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, needs_additional);
- return f_status_set_error(allocation_status);
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(needs_additional);
+ return status;
}
}
status = f_utf_char_to_character(arguments.argv[location] + sub_location, max_width, &character_argument_utf);
if (status != f_none) {
- f_macro_string_lengths_delete(status, needs_additional);
+ f_macro_string_lengths_delete_simple(needs_additional);
return status;
}
status = f_utf_char_to_character((f_string) parameters.parameter[parameter_counter].symbol_short, max_width, &character_console_utf);
if (status != f_none) {
- f_macro_string_lengths_delete(status, needs_additional);
+ f_macro_string_lengths_delete_simple(needs_additional);
return status;
}
}
if (parameters.parameter[parameter_counter].locations.used >= parameters.parameter[parameter_counter].locations.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, parameters.parameter[parameter_counter].locations, parameters.parameter[parameter_counter].locations.size + f_console_default_allocation_step);
+ f_macro_string_lengths_resize(status, parameters.parameter[parameter_counter].locations, parameters.parameter[parameter_counter].locations.size + f_console_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, needs_additional);
- return f_status_set_error(allocation_status);
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(needs_additional);
+ return status;
}
}
if (parameters.parameter[parameter_counter].has_additional) {
if (needs_additional.used + parameters.parameter[parameter_counter].has_additional > needs_additional.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, needs_additional, needs_additional.used + parameters.parameter[parameter_counter].has_additional);
- f_macro_string_lengths_resize(allocation_status, needs_additional, needs_additional.used + parameters.parameter[parameter_counter].has_additional);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, needs_additional);
- return f_status_set_error(allocation_status);
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(needs_additional);
+ return status;
}
}
}
if (parameters.parameter[parameter_counter].locations.used >= parameters.parameter[parameter_counter].locations.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, parameters.parameter[parameter_counter].locations, parameters.parameter[parameter_counter].locations.size + f_console_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, parameters.parameter[parameter_counter].locations, parameters.parameter[parameter_counter].locations.size + f_console_default_allocation_step);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, needs_additional);
- return f_status_set_error(allocation_status);
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(needs_additional);
+ return status;
}
}
if (parameters.parameter[parameter_counter].has_additional) {
if (needs_additional.used + parameters.parameter[parameter_counter].has_additional > needs_additional.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, needs_additional, needs_additional.used + parameters.parameter[parameter_counter].has_additional);
+ f_macro_string_lengths_resize(status, needs_additional, needs_additional.used + parameters.parameter[parameter_counter].has_additional);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, needs_additional);
- return f_status_set_error(allocation_status);
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(needs_additional);
+ return status;
}
}
if (!found) {
// populate list of remaining parameters.parameter not associated with anything.
if (remaining->used >= remaining->size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, (*remaining), remaining->size + f_console_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, (*remaining), remaining->size + f_console_default_allocation_step);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, needs_additional);
- return f_status_set_error(allocation_status);
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(needs_additional);
+ return status;
}
}
status = f_none;
}
- {
- f_status allocation_status = f_none;
- f_macro_string_lengths_delete(allocation_status, needs_additional);
- }
+ f_macro_string_lengths_delete_simple(needs_additional);
return status;
}
// fll-0 includes
#include <level_0/status.h>
+#include <level_0/memory.h>
#include <level_0/string.h>
#include <level_0/type.h>
#define f_macro_fss_delimits_clear(delimits) f_macro_memory_structure_clear(delimits)
- #define f_macro_fss_delimits_new(status, delimits) f_macro_string_locations_new(status, delimits)
+ #define f_macro_fss_delimits_new(status, delimits) f_macro_string_locations_new(status, delimits)
#define f_macro_fss_delimits_delete(status, delimits) f_macro_string_locations_delete(status, delimits)
#define f_macro_fss_delimits_destroy(status, delimits) f_macro_string_locations_destroy(status, delimits)
+ #define f_macro_fss_delimits_delete_simple(delimits) f_macro_string_locations_delete_simple(delimits)
+ #define f_macro_fss_delimits_destroy_simple(delimits) f_macro_string_locations_destroy_simple(delimits)
+
#define f_macro_fss_delimits_resize(status, delimits, new_length) f_macro_string_locations_resize(status, delimits, new_length)
#define f_macro_fss_delimits_adjust(status, delimits, new_length) f_macro_string_locations_adjust(status, delimits, new_length)
#endif // _di_f_fss_delimits_
#define f_macro_fss_headers_new(status, headers, length) f_macro_memory_structure_new(status, headers, f_fss_header, length)
- #define f_macro_fss_headers_delete(status, headers) f_macro_memory_structure_delete(status, headers, f_fss_header)
+ #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_macro_fss_headers_delete_simple(headers) f_macro_memory_structure_delete_simple(headers, f_fss_header)
+ #define f_macro_fss_headers_destroy_simple(headers) f_macro_memory_structure_destroy_simple(headers, f_fss_header)
+
#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_
#define f_macro_fss_object_new(status, object, length) status = f_memory_new((void **) & object, sizeof(f_fss_object), length)
- #define f_macro_fss_object_delete(status, object) status = f_memory_delete((void **) & object)
- #define f_macro_fss_object_destroy(status, object, size) status = f_memory_destroy((void **) & object, sizeof(f_fss_object), size)
+ #define f_macro_fss_object_delete(status, object) status = f_memory_delete((void **) & object)
+ #define f_macro_fss_object_destroy(status, object, length) status = f_memory_destroy((void **) & object, sizeof(f_fss_object), length)
+
+ #define f_macro_fss_object_delete_simple(object) f_memory_delete((void **) & object)
+ #define f_macro_fss_object_destroy_simple(object, length) f_memory_destroy((void **) & object, sizeof(f_fss_object), length)
#define f_macro_fss_object_resize(status, object, old_length, new_length) status = f_memory_resize((void **) & object, sizeof(f_fss_object), old_length, new_length)
#define f_macro_fss_objects_new(status, objects, length) f_macro_memory_structure_new(status, objects, f_fss_object, length)
- #define f_macro_fss_objects_delete(status, objects) f_macro_memory_structure_delete(status, objects, f_fss_object)
+ #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_macro_fss_objects_delete_simple(objects) f_macro_memory_structure_delete_simple(objects, f_fss_object)
+ #define f_macro_fss_objects_destroy_simple(objects) f_macro_memory_structure_destroy_simple(objects, f_fss_object)
+
#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_
#define f_macro_fss_content_new(status, content, length) f_macro_memory_structure_new(status, content, f_string_location, length)
- #define f_macro_fss_content_delete(status, content) f_macro_memory_structure_delete(status, content, f_string_location)
+ #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_macro_fss_content_delete_simple(content) f_macro_memory_structure_delete_simple(content, f_string_location)
+ #define f_macro_fss_content_destroy_simple(content) f_macro_memory_structure_destroy_simple(content, f_string_location)
+
#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_
#define f_macro_fss_contents_new(status, contents, length) f_macro_memory_structures_delete(status, contents, f_fss_content, length)
- #define f_macro_fss_contents_delete(status, contents) f_macro_memory_structures_delete(status, contents, f_fss_content)
+ #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_macro_fss_contents_delete_simple(contents) f_macro_memory_structures_delete_simple(contents, f_fss_content)
+ #define f_macro_fss_contents_destroy_simple(contents) f_macro_memory_structures_destroy_simple(contents, f_fss_content)
+
#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_
}
/**
+ * Delete a fss content child.
+ *
+ * content_child: the f_fss_content_child structure to operate on.
+ */
+ #define f_macro_fss_content_child_delete_simple(content_child) \
+ f_macro_fss_content_delete_simple(content_child.content); \
+ content_child.object.start = 1; \
+ content_child.object.stop = 0; \
+ content_child.parent = 0;
+
+ /**
+ * Destroy a fss content child.
+ *
+ * content_child: the f_fss_content_child structure to operate on.
+ */
+ #define f_macro_fss_content_child_destroy_simple(content_child) \
+ f_macro_fss_content_destroy_simple(content_child.content); \
+ content_child.object.start = 1; \
+ content_child.object.stop = 0; \
+ content_child.parent = 0;
+
+ /**
* Resize a fss content child.
*
* status: the status to return.
* }
*
* range: A location range representing the full start/stop locations of the entire set.
- * array: The array of objectm their associated content, and their associated parent.
+ * array: The array of object, their associated content, and their associated parent.
* size: Total amount of allocated space.
* used: Total number of allocated spaces used.
*/
*/
#define f_macro_fss_content_childs_delete(status, content_childs) \
status = f_none; \
- while (content_childs.size > 0) { \
- f_macro_fss_content_child_delete(status, content_childs.array[content_childs.size - 1]); \
+ content_childs.used = content_childs.size; \
+ while (content_childs.used > 0) { \
+ content_childs.used--; \
+ f_macro_fss_content_child_delete(status, content_childs.array[content_childs.used]); \
if (status != f_none) break; \
- content_childs.size--; \
} \
if (status == f_none) status = f_memory_delete((void **) & content_childs.array, sizeof(f_fss_content_child), content_childs.size); \
- if (status == f_none) content_childs.used = 0;
+ if (status == f_none) content_childs.size = 0;
/**
* Destroy a fss content childs.
*/
#define f_macro_fss_content_childs_destroy(status, content_childs) \
status = f_none; \
- while (content_childs.size > 0) { \
- f_macro_fss_content_child_destroy(status, content_childs.array[content_childs.size - 1]); \
+ content_childs.used = content_childs.size; \
+ while (content_childs.used > 0) { \
+ content_childs.used--; \
+ f_macro_fss_content_child_destroy(status, content_childs.array[content_childs.used]); \
if (status != f_none) break; \
- content_childs.size--; \
} \
if (status == f_none) status = f_memory_delete((void **) & content_childs.array, sizeof(f_fss_content_child), content_childs.size); \
- if (status == f_none) content_childs.used = 0;
+ if (status == f_none) content_childs.size = 0;
+
+ /**
+ * Delete a fss content childs.
+ *
+ * content_childs: the f_fss_content_childs structure to operate on.
+ */
+ #define f_macro_fss_content_childs_delete_simple(content_childs) \
+ content_childs.used = content_childs.size; \
+ while (content_childs.used > 0) { \
+ content_childs.used--; \
+ f_macro_fss_content_child_delete(content_childs.array[content_childs.used]); \
+ if (content_childs.used == 0) { \
+ if (f_memory_delete((void **) & content_childs.array, sizeof(f_fss_content_child), content_childs.size)) { \
+ content_childs.size = 0; \
+ } \
+ } \
+ }
+
+ /**
+ * Destroy a fss content childs.
+ *
+ * content_childs: the f_fss_content_childs structure to operate on.
+ */
+ #define f_macro_fss_content_childs_destroy_simple(content_childs) \
+ content_childs.used = content_childs.size; \
+ while (content_childs.used > 0) { \
+ content_childs.used--; \
+ f_macro_fss_content_child_destroy(status, content_childs.array[content_childs.used]); \
+ if (content_childs.used == 0) { \
+ if (f_memory_destroy((void **) & content_childs.array, sizeof(f_fss_content_child), content_childs.size)) { \
+ content_childs.size = 0; \
+ } \
+ } \
+ }
/**
* Resize a fss content childs.
*/
#define f_macro_fss_content_nest_delete(status, content_nest) \
status = f_none; \
- while (content_nest.size > 0) { \
- f_macro_fss_content_childs_delete(status, content_nest.array[content_nest.size - 1]); \
+ content_nest.used = content_nest.size; \
+ while (content_nest.used > 0) { \
+ content_nest.used--; \
+ f_macro_fss_content_childs_delete(status, content_nest.array[content_nest.used]); \
if (status != f_none) break; \
- content_nest.size--; \
} \
if (status == f_none) status = f_memory_delete((void **) & content_nest.array, sizeof(f_fss_content_childs), content_nest.size); \
- if (status == f_none) content_nest.used = 0;
+ if (status == f_none) content_nest.size = 0;
/**
* Destroy a fss content nest.
*/
#define f_macro_fss_content_nest_destroy(status, content_nest) \
status = f_none; \
- while (content_nest.size > 0) { \
- f_macro_fss_content_childs_destroy(status, content_nest.array[content_nest.size - 1]); \
+ content_nest.used = content_nest.size; \
+ while (content_nest.used > 0) { \
+ content_nest.used--; \
+ f_macro_fss_content_childs_destroy(status, content_nest.array[content_nest.used]); \
if (status != f_none) break; \
- content_nest.size--; \
} \
if (status == f_none) status = f_memory_delete((void **) & content_nest.array, sizeof(f_fss_content_childs), content_nest.size); \
- if (status == f_none) content_nest.used = 0;
+ if (status == f_none) content_nest.size = 0;
+
+ /**
+ * Delete a fss content nest.
+ *
+ * content_nest: the f_fss_content_nest structure to operate on.
+ */
+ #define f_macro_fss_content_nest_delete_simple(content_nest) \
+ content_nest.used = content_nest.size; \
+ while (content_nest.used > 0) { \
+ content_nest.used--; \
+ f_macro_fss_content_childs_delete_simple(content_nest.array[content_nest.used]); \
+ if (content_nest.used == 0) { \
+ if (f_memory_delete((void **) & content_nest.array, sizeof(f_fss_content_childs), content_nest.size)) { \
+ content_nest.size = 0; \
+ } \
+ } \
+ }
+
+ /**
+ * Destroy a fss content nest.
+ *
+ * content_nest: the f_fss_content_nest structure to operate on.
+ */
+ #define f_macro_fss_content_nest_destroy_simple(content_nest) \
+ content_nest.used = content_nest.size; \
+ while (content_nest.used > 0) { \
+ content_nest.used--; \
+ f_macro_fss_content_childs_destroy_simple(content_nest.array[content_nest.used]); \
+ if (content_nest.used == 0) { \
+ if (f_memory_destroy((void **) & content_nest.array, sizeof(f_fss_content_childs), content_nest.size)) { \
+ content_nest.size = 0; \
+ } \
+ } \
+ }
/**
* Resize a fss content nest.
* status: the status to return.
* content_nests: the f_fss_content_nests structure to operate on.
*/
- #define f_macro_fss_content_nests_delete(status, content_nests) \
+ #define f_macro_fss_content_nests_delete(content_nests) \
status = f_none; \
- while (content_nests.size > 0) { \
- f_macro_fss_content_nest_delete(status, content_nests.array[content_nests.size - 1]); \
+ content_nests.used = content_nests.size; \
+ while (content_nests.used > 0) { \
+ content_nests.used--; \
+ f_macro_fss_content_nest_delete(status, content_nests.array[content_nests.used]); \
if (status != f_none) break; \
- content_nests.size--; \
} \
if (status == f_none) status = f_memory_delete((void **) & content_nests.array, sizeof(f_fss_content_nest), content_nests.size); \
- if (status == f_none) content_nests.used = 0;
+ if (status == f_none) content_nests.size = 0;
/**
* Destroy a fss content nests.
* status: the status to return.
* content_nests: the f_fss_content_nests structure to operate on.
*/
- #define f_macro_fss_content_nests_destroy(status, content_nests) \
+ #define f_macro_fss_content_nests_destroy(content_nests) \
status = f_none; \
- while (content_nests.size > 0) { \
- f_macro_fss_content_nest_destroy(status, content_nests.array[content_nests.size - 1]); \
+ content_nests.used = content_nests.size; \
+ while (content_nests.used > 0) { \
+ content_nests.used--; \
+ f_macro_fss_content_nest_destroy(status, content_nests.array[content_nests.used]); \
if (status != f_none) break; \
- content_nests.size--; \
} \
- if (status == f_none) status = f_memory_delete((void **) & content_nests.array, sizeof(f_fss_content_nest), content_nests.size); \
- if (status == f_none) content_nests.used = 0;
+ if (status == f_none) status = f_memory_destroy((void **) & content_nests.array, sizeof(f_fss_content_nest), content_nests.size); \
+ if (status == f_none) content_nests.size = 0;
+
+ /**
+ * Delete a fss content nests.
+ *
+ * content_nests: the f_fss_content_nests structure to operate on.
+ */
+ #define f_macro_fss_content_nests_delete_simple(content_nests) \
+ content_nests.used = content_nests.size; \
+ while (content_nests.used > 0) { \
+ content_nests.used--; \
+ f_macro_fss_content_nest_delete_simple(content_nests.array[content_nests.used]); \
+ if (content_nests.used == 0) { \
+ if (f_memory_delete((void **) & content_nests.array, sizeof(f_fss_content_nest), content_nests.size)) { \
+ content_nests.size = 0; \
+ } \
+ } \
+ }
+
+ /**
+ * Destroy a fss content nests.
+ *
+ * content_nests: the f_fss_content_nests structure to operate on.
+ */
+ #define f_macro_fss_content_nests_destroy_simple(content_nests) \
+ content_nests.used = content_nests.size; \
+ while (content_nests.used > 0) { \
+ content_nests.used--; \
+ f_macro_fss_content_nest_destroy_simple(content_nests.array[content_nests.used]); \
+ if (content_nests.used == 0) { \
+ if (f_memory_destroy((void **) & content_nests.array, sizeof(f_fss_content_nest), content_nests.size)) { \
+ content_nests.size = 0; \
+ } \
+ } \
+ }
/**
* Resize a fss content nests.
#endif // _di_f_macro_memory_structure_destroy_
/**
+ * Delete a generic memory structure.
+ *
+ * structure: the structure to operate on.
+ * type: the structure type.
+ */
+#ifndef _di_f_macro_memory_structure_delete_simple_
+ #define f_macro_memory_structure_delete_simple(structure, type) \
+ if (f_memory_delete((void **) & structure.array, sizeof(type), structure.size) == f_none) { \
+ structure.size = 0; \
+ structure.used = 0; \
+ }
+#endif // _di_f_macro_memory_structure_delete_simple_
+
+/**
+ * Destroy a generic memory structure.
+ *
+ * structure: the structure to operate on.
+ * type: the structure type.
+ */
+#ifndef _di_f_macro_memory_structure_destroy_simple_
+ #define f_macro_memory_structure_destroy_simple(structure, type) \
+ if (f_memory_destroy((void **) & structure.array, sizeof(type), structure.size) == f_none) { \
+ structure.size = 0; \
+ structure.used = 0; \
+ }
+#endif // _di_f_macro_memory_structure_destroy_simple_
+
+/**
* Resize a generic memory structure.
*
* status: the status to return.
#ifndef _di_f_macro_memory_structures_delete_
#define f_macro_memory_structures_delete(status, structures, type) \
status = f_none; \
- while (structures.size > 0) { \
- f_macro_memory_structure_delete(status, structures.array[structures.size - 1], type); \
+ structures.used = structures.size; \
+ while (structures.used > 0) { \
+ structures.used--; \
+ f_macro_memory_structure_delete(status, structures.array[structures.used], type); \
if (status != f_none) break; \
- structures.size--; \
} \
if (status == f_none) status = f_memory_delete((void **) & structures.array, sizeof(type), structures.size); \
- if (status == f_none) structures.used = 0;
+ if (status == f_none) structures.size = 0;
#endif // _di_f_macro_memory_structures_delete_
/**
#ifndef _di_f_macro_memory_structures_destroy_
#define f_macro_memory_structures_destroy(status, structures, type) \
status = f_none; \
- while (structures.size > 0) { \
- f_macro_memory_structure_destroy(status, structures.array[structures.size - 1], type); \
+ structures.used = structures.size; \
+ while (structures.used > 0) { \
+ structures.used--; \
+ f_macro_memory_structure_destroy(status, structures.array[structures.used], type); \
if (status != f_none) break; \
- structures.size--; \
} \
if (status == f_none) status = f_memory_destroy((void **) & structures.array, sizeof(type), structures.size); \
- if (status == f_none) structures.used = 0;
+ if (status == f_none) structures.size = 0;
#endif // _di_f_macro_memory_structures_destroy_
/**
+ * Delete a generic memory structures.
+ *
+ * structures: the structures to operate on.
+ * type: the structure type..
+ */
+#ifndef _di_f_macro_memory_structures_delete_simple_
+ #define f_macro_memory_structures_delete_simple(structures, type) \
+ structures.used = structures.size; \
+ while (structures.used > 0) { \
+ structures.used--; \
+ f_macro_memory_structure_delete_simple(structures.array[structures.used], type); \
+ if (structures.used == 0) { \
+ if (f_memory_delete((void **) & structures.array, sizeof(type), structures.size)) { \
+ structures.size = 0; \
+ } \
+ } \
+ }
+#endif // _di_f_macro_memory_structures_delete_simple_
+
+/**
+ * Destroy a generic memory structures.
+ *
+ * structures: the structures to operate on.
+ * type: the structure type.
+ */
+#ifndef _di_f_macro_memory_structures_destroy_simple_
+ #define f_macro_memory_structures_destroy_simple(structures, type) \
+ structures.used = structures.size; \
+ while (structures.used > 0) { \
+ structures.used--; \
+ f_macro_memory_structure_destroy_simple(structures.array[structures.used], type); \
+ if (structures.used == 0) { \
+ if (f_memory_destroy((void **) & structures.array, sizeof(type), structures.size)) { \
+ structures.size = 0; \
+ } \
+ } \
+ }
+#endif // _di_f_macro_memory_structures_destroy_simple_
+
+
+/**
* Resize a generic memory structures.
*
* status: the status to return.
#define f_string_max_size f_type_number_size_unsigned
#define f_string_initialize f_string_eos
- #define f_macro_string_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_string), length)
- #define f_macro_string_delete(status, string, size) status = f_memory_delete((void **) & string, sizeof(f_string), size)
- #define f_macro_string_destroy(status, string, size) status = f_memory_destroy((void **) & string, sizeof(f_string), size)
+ #define f_macro_string_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_string), length)
+ #define f_macro_string_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_string), length)
+ #define f_macro_string_destroy(status, string, length) status = f_memory_destroy((void **) & string, sizeof(f_string), length)
+
+ #define f_macro_string_delete_simple(string, length) f_memory_delete((void **) & string, sizeof(f_string), length)
+ #define f_macro_string_destroy_simple(string, length) f_memory_destroy((void **) & string, sizeof(f_string), length)
#define f_macro_string_resize(status, string, old_length, new_length) \
status = f_memory_resize((void **) & string, sizeof(f_string), old_length, new_length)
#define f_string_length_printf string_format_long_integer
- #define f_macro_string_length_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_string_length), length)
- #define f_macro_string_length_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_string_length), length)
- #define f_macro_string_length_destroy(status, string, size) status = f_memory_destroy((f_void_P *) & string, sizeof(f_string_length), size)
+ #define f_macro_string_length_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_string_length), length)
+ #define f_macro_string_length_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_string_length), length)
+ #define f_macro_string_length_destroy(status, string, length) status = f_memory_destroy((f_void_P *) & string, sizeof(f_string_length), length)
+
+ #define f_macro_string_length_delete_simple(string, length) f_memory_delete((void **) & string, sizeof(f_string_length), length)
+ #define f_macro_string_length_destroy_simple(string, length) f_memory_destroy((f_void_P *) & string, sizeof(f_string_length), length)
#define f_macro_string_length_resize(status, length, old_length, new_length) \
status = f_memory_resize((void **) & length, sizeof(f_string_length), old_length, new_length)
#define f_macro_string_lengths_new(status, lengths, length) f_macro_memory_structure_new(status, lengths, f_string_length, length)
- #define f_macro_string_lengths_delete(status, lengths) f_macro_memory_structure_delete(status, lengths, f_string_length)
+ #define f_macro_string_lengths_delete(status, lengths) f_macro_memory_structure_delete(status, lengths, f_string_length)
#define f_macro_string_lengths_destroy(status, lengths) f_macro_memory_structure_destroy(status, lengths, f_string_length)
+ #define f_macro_string_lengths_delete_simple(lengths) f_macro_memory_structure_delete_simple(lengths, f_string_length)
+ #define f_macro_string_lengths_destroy_simple(lengths) f_macro_memory_structure_destroy_simple(lengths, f_string_length)
+
#define f_macro_string_lengths_resize(status, lengths, new_length) f_macro_memory_structure_resize(status, lengths, f_string_length, new_length)
#define f_macro_string_lengths_adjust(status, lengths, new_length) f_macro_memory_structure_adjust(status, lengths, f_string_length, new_length)
#endif // _di_f_string_lengths_
#define f_string_location_initialize { 1, 0 }
- #define f_macro_string_location_new(status, string_location, length) status = f_memory_new((void **) & string_location, sizeof(f_string_location), length)
- #define f_macro_string_location_delete(status, string_location, size) status = f_memory_delete((void **) & string_location, sizeof(f_string_location), size)
- #define f_macro_string_location_destroy(status, string_location, size) status = f_memory_destroy((void **) & string_location, sizeof(f_string_location), size)
+ #define f_macro_string_location_new(status, string_location, length) status = f_memory_new((void **) & string_location, sizeof(f_string_location), length)
+ #define f_macro_string_location_delete(status, string_location, length) status = f_memory_delete((void **) & string_location, sizeof(f_string_location), length)
+ #define f_macro_string_location_destroy(status, string_location, length) status = f_memory_destroy((void **) & string_location, sizeof(f_string_location), length)
+
+ #define f_macro_string_location_delete_simple(string_location, length) f_memory_delete((void **) & string_location, sizeof(f_string_location), length)
+ #define f_macro_string_location_destroy_simple(string_location, length) f_memory_destroy((void **) & string_location, sizeof(f_string_location), length)
#define f_macro_string_location_resize(status, string_location, old_length, new_length) \
status = f_memory_resize((void **) & string_location, sizeof(f_string_location), old_length, new_length)
#define f_macro_string_locations_new(status, locations, length) f_macro_memory_structure_new(status, locations, f_string_location, length)
- #define f_macro_string_locations_delete(status, locations) f_macro_memory_structure_delete(status, locations, f_string_location)
+ #define f_macro_string_locations_delete(status, locations) f_macro_memory_structure_delete(status, locations, f_string_location)
#define f_macro_string_locations_destroy(status, locations) f_macro_memory_structure_destroy(status, locations, f_string_location)
+ #define f_macro_string_locations_delete_simple(locations) f_macro_memory_structure_delete_simple(locations, f_string_location)
+ #define f_macro_string_locations_destroy_simple(locations) f_macro_memory_structure_destroy_simple(locations, f_string_location)
+
#define f_macro_string_locations_resize(status, locations, new_length) f_macro_memory_structure_resize(status, locations, f_string_location, new_length)
#define f_macro_string_locations_adjust(status, locations, new_length) f_macro_memory_structure_adjust(status, locations, f_string_location, new_length)
#endif // _di_f_string_locations_
dynamic.used = 0; \
}
+ #define f_macro_string_dynamic_delete_simple(dynamic) \
+ f_memory_delete((void **) & dynamic.string, sizeof(f_string), dynamic.size); \
+ dynamic.size = 0; \
+ dynamic.used = 0;
+
+ #define f_macro_string_dynamic_destroy_simple(dynamic) \
+ f_memory_destroy((void **) & dynamic.string, sizeof(f_string), dynamic.size); \
+ dynamic.size = 0; \
+ dynamic.used = 0;
+
#define f_macro_string_dynamic_resize(status, dynamic, new_length) \
status = f_memory_resize((void **) & dynamic.string, sizeof(f_string), dynamic.size, new_length); \
if (status == f_none) { \
#define f_macro_string_dynamics_delete(status, dynamics) \
status = f_none; \
- while (dynamics.size > 0) { \
- --dynamics.size; \
- f_macro_string_dynamic_destroy(status, dynamics.array[dynamics.size]); \
+ dynamics.used = dynamics.size; \
+ while (dynamics.used > 0) { \
+ dynamics.used--; \
+ f_macro_string_dynamic_delete(status, dynamics.array[dynamics.used]); \
if (status != f_none) break; \
} \
if (status == f_none) status = f_memory_delete((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size); \
- if (status == f_none) dynamics.used = 0;
+ if (status == f_none) dynamics.size = 0;
#define f_macro_string_dynamics_destroy(status, dynamics) \
status = f_none; \
- while (dynamics.size > 0) { \
- --dynamics.size; \
- f_macro_string_dynamic_destroy(status, dynamics.array[dynamics.size]); \
+ dynamics.used = dynamics.size; \
+ while (dynamics.used > 0) { \
+ dynamics.used--; \
+ f_macro_string_dynamic_destroy(status, dynamics.array[dynamics.used]); \
if (status != f_none) break; \
} \
if (status == f_none) status = f_memory_destroy((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size); \
- if (status == f_none) dynamics.used = 0;
+ if (status == f_none) dynamics.size = 0;
+
+ #define f_macro_string_dynamics_delete_simple(dynamics) \
+ dynamics.used = dynamics.size; \
+ while (dynamics.used > 0) { \
+ dynamics.used--; \
+ f_macro_string_dynamic_delete_simple(dynamics.array[dynamics.used]); \
+ if (dynamics.used == 0) { \
+ if (f_memory_delete((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size)) { \
+ dynamics.size = 0; \
+ } \
+ } \
+ }
+
+ #define f_macro_string_dynamics_destroy_simple(dynamics) \
+ dynamics.used = dynamics.size; \
+ while (dynamics.used > 0) { \
+ dynamics.used--; \
+ f_macro_string_dynamic_destroy_simple(dynamics.array[dynamics.used]); \
+ if (dynamics.used == 0) { \
+ if (f_memory_destroy((void **) & dynamics.array, sizeof(f_string_dynamic), dynamics.size)) { \
+ dynamics.size = 0; \
+ } \
+ } \
+ }
#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_macro_string_dynamic_destroy(status, dynamics.array[i]); \
+ f_macro_string_dynamic_delete(status, dynamics.array[i]); \
if (status != f_none) break; \
} \
} \
#define f_macro_array_lengths_new(status, lengths, length) f_macro_memory_structure_new(status, lengths, f_array_length, length)
- #define f_macro_array_lengths_delete(status, lengths) f_macro_memory_structure_delete(status, lengths, f_array_length)
+ #define f_macro_array_lengths_delete(status, lengths) f_macro_memory_structure_delete(status, lengths, f_array_length)
#define f_macro_array_lengths_destroy(status, lengths) f_macro_memory_structure_destroy(status, lengths, f_array_length)
+ #define f_macro_array_lengths_delete_simple(lengths) f_macro_memory_structure_delete_simple(lengths, f_array_length)
+ #define f_macro_array_lengths_destroy_simple(lengths) f_macro_memory_structure_destroy_simple(lengths, f_array_length)
+
#define f_macro_array_lengths_resize(status, lengths, new_length) f_macro_memory_structure_resize(status, lengths, f_array_length, new_length)
#define f_macro_array_lengths_adjust(status, lengths, new_length) f_macro_memory_structure_adjust(status, lengths, f_array_length, new_length)
#endif // _di_f_array_lengths_
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);
+ #define fl_macro_color_context_delete_simple(color_context) \
+ f_macro_string_dynamic_delete_simple(color_context.reset); \
+ f_macro_string_dynamic_delete_simple(color_context.warning); \
+ f_macro_string_dynamic_delete_simple(color_context.error); \
+ f_macro_string_dynamic_delete_simple(color_context.title); \
+ f_macro_string_dynamic_delete_simple(color_context.notable); \
+ f_macro_string_dynamic_delete_simple(color_context.important); \
+ f_macro_string_dynamic_delete_simple(color_context.standout); \
+ f_macro_string_dynamic_delete_simple(color_context.normal); \
+ f_macro_string_dynamic_delete_simple(color_context.normal_reset);
+
+ #define fl_macro_color_context_destroy_simple(color_context, size) \
+ f_macro_string_dynamic_destroy_simple(color_context.reset); \
+ f_macro_string_dynamic_destroy_simple(color_context.warning, size); \
+ f_macro_string_dynamic_destroy_simple(color_context.error, size); \
+ f_macro_string_dynamic_destroy_simple(color_context.title, size); \
+ f_macro_string_dynamic_destroy_simple(color_context.notable, size); \
+ f_macro_string_dynamic_destroy_simple(color_context.important, size); \
+ f_macro_string_dynamic_destroy_simple(color_context.standout, size); \
+ f_macro_string_dynamic_destroy_simple(color_context.normal); \
+ f_macro_string_dynamic_destroy_simple(color_context.normal_reset);
+
#define fl_macro_color_context_resize(status, color_context) \
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); \
f_macro_string_dynamics_resize(status, (*names), names->size + fl_directory_default_allocation_step);
if (f_status_is_error(status)) {
- f_status status2 = f_none;
-
for (int j = i; j < length; j++) {
f_memory_delete((void **) & listing[i], sizeof(char *), 1);
- }
+ } // for
- f_macro_string_dynamics_delete(status2, (*names));
+ f_macro_string_dynamics_delete_simple((*names));
f_memory_delete((void **) & listing, sizeof(struct dirent *), 1);
return status;
f_macro_string_dynamic_new(status, names->array[names->used], size);
if (f_status_is_error(status)) {
- f_status status2 = f_none;
-
for (int j = i; j < length; j++) {
f_memory_delete((void **) & listing[i], sizeof(char *), 1);
- }
+ } // for
- f_macro_string_dynamics_delete(status2, (*names));
+ f_macro_string_dynamics_delete_simple((*names));
f_memory_delete((void **) & listing, sizeof(struct dirent *), 1);
return status;
if (buffer->string[location->start] == f_fss_delimit_single_quote || buffer->string[location->start] == f_fss_delimit_double_quote) {
if (delimits.used >= delimits.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, delimits, delimits.size + f_fss_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + f_fss_default_allocation_step);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
if (slash_count % 2 == 0) {
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, f_no_data_on_eos, f_no_data_on_stop)
- {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- }
+ f_macro_string_lengths_delete_simple(delimits);
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) return status;
}
else {
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, f_no_data_on_eos, f_no_data_on_stop)
- {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- }
+ f_macro_string_lengths_delete_simple(delimits);
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) return status;
fl_macro_fss_object_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, f_none_on_eos, f_none_on_stop)
}
else if (buffer->string[location->start] == f_string_eol) {
- {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- }
+ f_macro_string_lengths_delete_simple(delimits);
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) return status;
fl_macro_fss_object_return_on_overflow((*buffer), (*location), (*found), delimits, f_no_data_on_eos, f_no_data_on_stop)
- {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- }
+ f_macro_string_lengths_delete_simple(delimits);
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) return status;
location->start = first_slash;
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
}
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
if (buffer->string[location->start] == f_fss_delimit_single_quote || buffer->string[location->start] == f_fss_delimit_double_quote) {
if (delimits.used >= delimits.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, delimits, delimits.size + f_fss_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + f_fss_default_allocation_step);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
location->start = first_slash;
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
}
else {
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
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_macro_string_lengths_delete(allocation_status, delimits);
+ f_macro_string_lengths_delete_simple(delimits);
return status;
}
if (buffer->string[location->start] == f_fss_delimit_single_quote || buffer->string[location->start] == f_fss_delimit_double_quote) {
if (delimits.used >= delimits.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + f_fss_default_allocation_step);
+ f_macro_string_lengths_resize(status, delimits, delimits.size + f_fss_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
if (slash_count % 2 == 0) {
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
}
else {
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
location->start = first_slash;
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
-
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(allocation_status, delimits);
- return allocation_status;
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ return status;
}
}
f_macro_string_lengths_new(status, positions_start, f_fss_default_allocation_step);
if (f_status_is_error(status)) {
- f_macro_string_lengths_delete(status, delimits);
+ f_macro_string_lengths_delete_simple(delimits);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
slash_count++;
}
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
}
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
location->start = slash_first;
if (delimits.used + (slash_count / 2) >= delimits.size) {
- f_status allocation_status = f_none;
+ f_macro_string_lengths_resize(status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + (slash_count / 2) + f_fss_default_allocation_step);
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, delimits);
- f_macro_string_lengths_delete(status, positions_start);
-
- return allocation_status;
+ return status;
}
}
f_macro_string_lengths_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
location->start = slash_last;
if (delimits.used + 1 >= delimits.size) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_resize(allocation_status, delimits, delimits.size + f_fss_default_allocation_step);
+ f_macro_string_lengths_resize(status, delimits, delimits.size + f_fss_default_allocation_step);
- if (f_status_is_error(allocation_status)) {
- f_macro_string_lengths_delete(status, delimits);
- f_macro_string_lengths_delete(status, positions_start);
+ if (f_status_is_error(status)) {
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
- return allocation_status;
+ return status;
}
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
}
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
f_macro_string_lengths_resize(status, positions_start, positions_start.size + f_fss_default_allocation_step);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
}
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
f_macro_fss_content_nest_resize(status, (*found), found->size + f_fss_default_allocation_step);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
f_macro_fss_content_childs_resize(status, found->array[depth], found->array[depth].size + f_fss_default_allocation_step);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
f_macro_fss_content_resize(status, found->array[depth].array[position].content, found->array[depth].array[position].content.size + f_fss_default_allocation_step);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
position_previous = location->start;
status = fl_fss_increment_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
location->start = last_newline;
status = fl_fss_decrement_buffer(*buffer, location, 1);
if (f_status_is_error(status)) {
- f_status allocation_status = f_none;
-
- f_macro_string_lengths_delete(allocation_status, delimits);
- f_macro_string_lengths_delete(allocation_status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return status;
}
fl_macro_fss_content_nest_delimited_return_on_overflow((*buffer), (*location), (*found), delimits, positions_start, f_none_on_eos, f_none_on_stop)
- f_macro_string_lengths_delete(status, delimits);
- f_macro_string_lengths_delete(status, positions_start);
+ f_macro_string_lengths_delete_simple(delimits);
+ f_macro_string_lengths_delete_simple(positions_start);
return fl_fss_found_content;
}
f_macro_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_macro_string_delete(status, program_name, name_size);
+ if (name_size > 0) f_macro_string_delete_simple(program_name, name_size);
for (f_string_length j = 0; j < i; j++) {
- f_macro_string_delete(status2, fixed_arguments[i + 1], arguments.array[j].used + 1);
- }
+ f_macro_string_delete_simple(fixed_arguments[i + 1], arguments.array[j].used + 1);
+ } // for
return status;
}
process_id = vfork();
if (process_id < 0) {
- f_status status2 = f_none;
-
- if (name_size > 0) f_macro_string_delete(status, program_name, name_size);
+ if (name_size > 0) f_macro_string_delete_simple(program_name, name_size);
for (f_string_length i = 0; i < arguments.used; i++) {
- f_macro_string_delete(status2, fixed_arguments[i + 1], arguments.array[i].used + 1);
+ f_macro_string_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
} // for
return f_status_set_error(f_fork_failed);
// have the parent wait for the child process to finish
waitpid(process_id, results, 0);
- if (name_size > 0) f_macro_string_delete(status, program_name, name_size);
+ if (name_size > 0) f_macro_string_delete_simple(program_name, name_size);
- {
- f_status status2 = f_none;
-
- for (f_string_length i = 0; i < arguments.used; i++) {
- f_macro_string_delete(status2, fixed_arguments[i + 1], arguments.array[i].used + 1);
- } // for
- }
+ for (f_string_length i = 0; i < arguments.used; i++) {
+ f_macro_string_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
+ } // for
if (*results != 0) return f_status_set_error(f_failure);
f_macro_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_macro_string_delete(status2, fixed_arguments[i + 1], arguments.array[j].used + 1);
- }
+ f_macro_string_delete_simple(fixed_arguments[i + 1], arguments.array[j].used + 1);
+ } // for
return status;
}
process_id = vfork();
if (process_id < 0) {
- f_status status2 = f_none;
-
for (f_string_length i = 0; i < arguments.used; i++) {
- f_macro_string_delete(status2, fixed_arguments[i + 1], arguments.array[i].used + 1);
+ f_macro_string_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
} // for
return f_status_set_error(f_fork_failed);
// have the parent wait for the child process to finish
waitpid(process_id, results, 0);
- {
- f_status status2 = f_none;
-
- for (f_string_length i = 0; i < arguments.used; i++) {
- f_macro_string_delete(status2, fixed_arguments[i + 1], arguments.array[i].used + 1);
- }
- }
+ for (f_string_length i = 0; i < arguments.used; i++) {
+ f_macro_string_delete_simple(fixed_arguments[i + 1], arguments.array[i].used + 1);
+ } // for
if (*results != 0) return f_status_set_error(f_failure);
#ifndef _di_fll_program_process_parameters_
f_return_status fll_program_process_parameters(const f_console_arguments arguments, f_console_parameters parameters, const f_console_parameter_ids choices, f_string_lengths *remaining, fl_color_context *context) {
f_status status = f_none;
- f_status allocation_status = f_none;
status = f_console_parameter_process(arguments, parameters, remaining);
// load colors unless told not to.
if (decision != choices.id[0]) {
+ f_status allocation_status = f_none;
+
fl_macro_color_context_new(allocation_status, (*context));
if (f_status_is_error(allocation_status)) {
#ifndef _di_byte_dump_delete_data_
f_return_status byte_dump_delete_data(byte_dump_data *data) {
- f_status status = f_none;
for (f_string_length i = 0; i < byte_dump_total_parameters; i++) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
} // for
- f_macro_string_lengths_delete(status, data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ f_macro_string_lengths_delete_simple(data->remaining);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
parameters.array[5].used = 0;
parameters.array[6].used = 0;
- f_macro_string_dynamics_delete(status, parameters);
+ f_macro_string_dynamics_delete_simple( parameters);
firewall_delete_local_data(&local);
firewall_delete_data(data);
return status;
status = firewall_buffer_rules(file_path.string, f_true, &local, data);
- f_status status2 = f_none;
- f_macro_string_dynamic_delete(status2, file_path);
+ f_macro_string_dynamic_delete_simple(file_path);
}
if (f_status_is_error(status)) {
#ifndef _di_firewall_delete_data_
f_return_status firewall_delete_data(firewall_data *data) {
- f_status status = f_none;
f_string_length i = 0;
while (i < firewall_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- f_macro_string_dynamics_delete(status, data->chains);
- f_macro_string_lengths_delete(status, data->remaining);
- f_macro_string_dynamics_delete(status, data->devices);
+ f_macro_string_dynamics_delete_simple(data->chains);
+ f_macro_string_lengths_delete_simple(data->remaining);
+ f_macro_string_dynamics_delete_simple(data->devices);
- fl_macro_color_context_delete(status, data->context);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
f_return_status firewall_perform_commands(const firewall_local_data local, const firewall_data data) {
f_status status = f_none;
- f_status status2 = f_none;
f_string_length i = 0;
f_string_dynamics arguments = f_string_dynamics_initialize;
f_macro_string_dynamic_new(status, device, data.devices.array[local.device].used);
if (f_status_is_error(status)) {
- f_macro_string_dynamic_delete(status2, device);
+ f_macro_string_dynamic_delete_simple(device);
return status;
}
is_ip_list = f_false;
ip_list_direction = f_false;
- f_macro_string_dynamic_delete(status2, ip_list);
+ f_macro_string_dynamic_delete_simple(ip_list);
// process chain rule
if (length >= firewall_chain_length && fl_string_compare(local.buffer.string + local.rule_objects.array[i].start, (f_string) firewall_chain, length, firewall_chain_length) == f_equal_to) {
invalid = f_true;
}
else if (length >= firewall_device_all_length && fl_string_compare(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_macro_string_dynamic_delete(status, device);
+ f_macro_string_dynamic_delete_simple(device);
device_all = f_true;
continue;
}
device.used = data.devices.array[local.device].used;
}
else {
- f_macro_string_dynamic_delete(status, device);
+ f_macro_string_dynamic_delete_simple(device);
}
device_all = f_false;
device.used = length;
}
else {
- f_macro_string_dynamic_delete(status, device);
+ f_macro_string_dynamic_delete_simple(device);
}
device_all = f_false;
use_protocol = f_false;
}
else if (length > 0) {
- f_macro_string_dynamic_delete(status, protocol);
+ f_macro_string_dynamic_delete_simple(protocol);
f_macro_string_dynamic_new(status, protocol, length);
if (f_status_is_error(status)) break;
for (r = repeat; r > 0; r--) {
// first add the program name
- f_macro_string_dynamics_delete(status, arguments);
+ f_macro_string_dynamics_delete_simple(arguments);
f_macro_string_dynamics_new(status, arguments, firewall_default_allocation_step);
if (f_status_is_error(status)) break;
}
}
- f_macro_string_dynamic_delete(status, argument);
+ f_macro_string_dynamic_delete_simple(argument);
if (f_status_is_error(status)) break;
if (argument.used > 0) {
firewall_macro_append_argument_to_arguments(status, arguments, argument)
if (f_status_is_error(status)) {
- f_macro_string_dynamic_delete(status2, argument);
+ f_macro_string_dynamic_delete_simple(argument);
break;
}
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_macro_string_dynamic_delete(status2, ip_list_action);
+ f_macro_string_dynamic_delete_simple(ip_list_action);
}
else {
f_string_dynamic ip_argument = f_string_dynamic_initialize;
firewall_macro_append_argument_to_arguments(status, arguments, ip_list_action)
if (f_status_is_error(status)) {
- f_macro_string_dynamic_delete(status2, ip_argument);
+ f_macro_string_dynamic_delete_simple(ip_argument);
break;
}
fprintf(f_standard_error, "\n");
// remove ip_argument from arguments string.
- f_macro_string_dynamic_delete(status2, arguments.array[arguments.used]);
+ f_macro_string_dynamic_delete_simple(arguments.array[arguments.used]);
arguments.used--;
break;
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_macro_string_dynamic_delete(status2, arguments.array[arguments.used]);
+ f_macro_string_dynamic_delete_simple(arguments.array[arguments.used]);
arguments.used--;
break;
}
// remove ip_argument from arguments string.
- f_macro_string_dynamic_delete(status2, arguments.array[arguments.used]);
+ f_macro_string_dynamic_delete_simple(arguments.array[arguments.used]);
arguments.used--;
} // for
- f_macro_string_dynamic_delete(status2, ip_argument);
+ f_macro_string_dynamic_delete_simple(ip_argument);
// remove ip_list_action from arguments string.
- f_macro_string_dynamic_delete(status2, arguments.array[arguments.used]);
+ f_macro_string_dynamic_delete_simple(arguments.array[arguments.used]);
arguments.used--;
}
}
}
}
- 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);
+ f_macro_string_dynamic_delete_simple(local_buffer);
+ f_macro_string_dynamic_delete_simple(file_path);
+ f_macro_fss_objects_delete_simple(basic_objects);
+ f_macro_fss_contents_delete_simple(basic_contents);
if (status == f_failure || status == f_invalid_parameter) break;
}
} // for
} // for
- 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);
+ f_macro_string_dynamic_delete_simple(ip_list);
+ f_macro_string_dynamic_delete_simple(argument);
+ f_macro_string_dynamics_delete_simple(arguments);
+ f_macro_string_dynamic_delete_simple(device);
+ f_macro_string_dynamic_delete_simple(protocol);
return status;
}
f_return_status firewall_create_custom_chains(firewall_reserved_chains *reserved, firewall_local_data *local, firewall_data *data) {
f_status status = f_none;
- f_status status2 = f_none;
uint8_t tool = firewall_program_iptables;
bool new_chain = f_false;
f_string_dynamic fixed_string = f_string_dynamic_initialize;
- f_macro_array_lengths_delete(status, local->chain_ids);
+ f_macro_array_lengths_delete_simple(local->chain_ids);
f_macro_array_lengths_new(status, local->chain_ids, local->chain_objects.used);
if (f_status_is_error(status)) {
f_macro_string_dynamic_new(status, arguments.array[0], firewall_chain_create_command_length);
if (f_status_is_error(status)) {
- f_macro_string_dynamics_delete(status2, arguments);
+ f_macro_string_dynamics_delete_simple(arguments);
return status;
}
if (f_status_is_error(status)) {
arguments.used = 1;
- f_macro_string_dynamics_delete(status2, arguments);
+ f_macro_string_dynamics_delete_simple(arguments);
return status;
}
f_macro_string_dynamics_resize(status, data->chains, data->chains.used + firewall_default_allocation_step);
if (f_status_is_error(status)) {
- f_macro_string_dynamics_delete(status2, arguments);
+ f_macro_string_dynamics_delete_simple(arguments);
return status;
}
f_macro_string_dynamic_resize(status, arguments.array[1], length);
if (f_status_is_error(status)) {
- f_macro_string_dynamics_delete(status2, arguments);
+ f_macro_string_dynamics_delete_simple(arguments);
return status;
}
f_macro_string_dynamic_new(status, data->chains.array[data->chains.used], length);
if (f_status_is_error(status)) {
- f_macro_string_dynamics_delete(status2, arguments);
+ f_macro_string_dynamics_delete_simple(arguments);
return status;
}
fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling fll_execute_program()", status);
}
- f_macro_string_dynamics_delete(status2, arguments);
+ f_macro_string_dynamics_delete_simple(arguments);
return status;
}
}
i++;
} // while
- f_macro_string_dynamics_delete(status2, arguments);
+ f_macro_string_dynamics_delete_simple(arguments);
return status;
}
f_return_status firewall_process_rules(f_string_location *input, firewall_local_data *local, firewall_data *data) {
f_status status = f_none;
- f_status status2 = f_none;
status = fll_fss_extended_read(&local->buffer, input, &local->rule_objects, &local->rule_contents);
fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status);
}
- f_macro_fss_objects_delete(status2, local->rule_objects);
- f_macro_fss_contents_delete(status2, local->rule_contents);
+ f_macro_fss_objects_delete_simple(local->rule_objects);
+ f_macro_fss_contents_delete_simple(local->rule_contents);
return status;
}
}
- f_macro_fss_objects_delete(status2, local->rule_objects);
- f_macro_fss_contents_delete(status2, local->rule_contents);
+ f_macro_fss_objects_delete_simple(local->rule_objects);
+ f_macro_fss_contents_delete_simple(local->rule_contents);
return status;
}
local->device = 0;
local->chain = 0;
- f_macro_string_dynamic_delete(status, local->buffer);
- f_macro_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);
+ f_macro_string_dynamic_delete_simple(local->buffer);
+ f_macro_array_lengths_delete_simple(local->chain_ids);
+ f_macro_fss_objects_delete_simple(local->chain_objects);
+ f_macro_fss_contents_delete_simple(local->chain_contents);
+ f_macro_fss_objects_delete_simple(local->rule_objects);
+ f_macro_fss_contents_delete_simple(local->rule_contents);
return f_none;
}
}
fss_basic_list_read_depths depths = fss_basic_list_read_depths_initialize;
- f_status status2 = f_none;
f_string_length counter = 0;
f_string_length original_size = data->file_position.total_elements;
status = fss_basic_list_read_main_preprocess_depth(arguments, *data, &depths);
if (f_status_is_error(status)) {
- macro_fss_basic_list_read_depths_delete(status2, depths);
+ macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
return status;
}
// This standard does not support nesting, so any depth greater than 0 can be predicted without processing the file.
- if (depths.used > 0 && depths.array[0].depth > 0) {
+ if (depths.array[0].depth > 0) {
if (data->parameters[fss_basic_list_read_parameter_total].result == f_console_result_found) {
fprintf(f_standard_output, "0%c", f_string_eol);
return f_none;
if (f_status_is_error(status)) {
fss_basic_list_read_print_file_error(data->context, "fl_file_read_fifo", "-", f_status_set_fine(status));
- macro_fss_basic_list_read_depths_delete(status2, depths);
+ macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
return status;
}
status = fss_basic_list_read_main_process_file(arguments, data, "-", depths);
if (f_status_is_error(status)) {
- macro_fss_basic_list_read_depths_delete(status2, depths);
+ macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
return status;
}
// Clear buffers before continuing.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
}
if (data->remaining.used > 0) {
if (f_status_is_error(status)) {
fss_basic_list_read_print_file_error(data->context, "f_file_open", arguments.argv[data->remaining.array[counter]], f_status_set_fine(status));
- macro_fss_basic_list_read_depths_delete(status2, depths);
+ macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
return status;
}
if (f_status_is_error(status)) {
fss_basic_list_read_print_file_error(data->context, "fl_file_read", arguments.argv[data->remaining.array[counter]], f_status_set_fine(status));
- macro_fss_basic_list_read_depths_delete(status2, depths);
+ macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
return status;
}
status = fss_basic_list_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths);
if (f_status_is_error(status)) {
- macro_fss_basic_list_read_depths_delete(status2, depths);
+ macro_fss_basic_list_read_depths_delete_simple(depths);
fss_basic_list_read_delete_data(data);
return status;
}
// Clear buffers before repeating the loop.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
} // for
}
- macro_fss_basic_list_read_depths_delete(status2, depths);
+ macro_fss_basic_list_read_depths_delete_simple(depths);
}
else {
fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you failed to specify one or more files.");
f_string_length i = 0;
while (i < fss_basic_list_read_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- 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_string_lengths_delete(status, data->remaining);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
+ f_macro_string_lengths_delete_simple(data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
#ifndef _di_fss_basic_list_read_main_process_file_
f_return_status fss_basic_list_read_main_process_file(const f_console_arguments arguments, fss_basic_list_read_data *data, const f_string filename, const fss_basic_list_read_depths depths) {
f_status status = f_none;
- f_status status2 = f_none;
{
f_string_location input = f_string_location_initialize;
}
else if (status == f_no_data_on_stop || status == f_no_data_on_eos) {
// Clear buffers, then attempt the next file.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
return f_status_set_warning(status);
}
f_string_length name_length = 0;
for (f_string_length i = 0; i < data->objects.used; i++) {
- name_length = data->objects.array[i].stop - data->objects.array[i].start + 1;
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
if (name_length == argv_length) {
if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name, name_length, argv_length) == f_equal_to) {
* A structure of parameters applied at some depth.
*
* depth: the depth number in which this is to be processed at.
- * parameter: the index representing the parameter enum of either the "at" parameter or the "name" parameter.
- * position: the parameter position index within the argv representing the value associated with the designated parameter.
+ *
+ * index_at: position of the "--at" parameter value in the argv list, when 0 there is no parameter.
+ * index_name: position of the "--name" parameter value in the argv list, when 0 there is no parameter.
+ *
+ * value_at: the value of the "--at" parameter, already processed and ready to use, only when index_at > 0.
+ * value_name: the value of the "--name" parameter, already processed and ready to use, only when index_name > 0.
*/
#ifndef _di_fss_basic_list_read_depth_
typedef struct {
#define macro_fss_basic_list_read_depths_new(status, depths, length) f_macro_memory_structure_new(status, depths, fss_basic_list_read_depth, length)
- #define macro_fss_basic_list_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_basic_list_read_depth)
+ #define macro_fss_basic_list_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_basic_list_read_depth)
#define macro_fss_basic_list_read_depths_destroy(status, depths) f_macro_memory_structure_destroy(status, depths, fss_basic_list_read_depth)
+ #define macro_fss_basic_list_read_depths_delete_simple(depths) f_macro_memory_structure_delete_simple(depths, fss_basic_list_read_depth)
+ #define macro_fss_basic_list_read_depths_destroy_simple(depths) f_macro_memory_structure_destroy_simple(depths, fss_basic_list_read_depth)
+
#define macro_fss_basic_list_read_depths_resize(status, depths, new_length) f_macro_memory_structure_resize(status, depths, fss_basic_list_read_depth, new_length)
#define macro_fss_basic_list_read_depths_adjust(status, depths, new_length) f_macro_memory_structure_adjust(status, depths, fss_basic_list_read_depth, new_length)
#endif // _di_fss_basic_list_read_depths_
fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
}
- f_status status2 = f_none;
-
- f_macro_string_dynamic_delete(status2, input);
+ f_macro_string_dynamic_delete_simple(input);
fss_basic_list_write_delete_data(data);
return f_status_set_error(status);
}
}
}
- f_macro_string_dynamic_delete(status, input);
+ f_macro_string_dynamic_delete_simple(input);
}
else if (data->parameters[fss_basic_list_write_parameter_string].result == f_console_result_additional) {
f_string_dynamic input = f_string_dynamic_initialize;
#ifndef _di_fss_basic_list_write_delete_data_
f_return_status fss_basic_list_write_delete_data(fss_basic_list_write_data *data) {
- f_status status = f_none;
f_string_length i = 0;
while (i < fss_basic_list_write_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- f_macro_string_lengths_delete(status, data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ f_macro_string_lengths_delete_simple(data->remaining);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
}
fss_basic_read_depths depths = fss_basic_read_depths_initialize;
- f_status status2 = f_none;
f_string_length counter = 0;
f_string_length original_size = data->file_position.total_elements;
status = fss_basic_read_main_preprocess_depth(arguments, *data, &depths);
if (f_status_is_error(status)) {
- macro_fss_basic_read_depths_delete(status2, depths);
+ macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
return status;
}
// This standard does not support nesting, so any depth greater than 0 can be predicted without processing the file.
- if (depths.used > 0 && depths.array[0].depth > 0) {
+ if (depths.array[0].depth > 0) {
if (data->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
fprintf(f_standard_output, "0%c", f_string_eol);
return f_none;
if (f_status_is_error(status)) {
fss_basic_read_print_file_error(data->context, "fl_file_read_fifo", "-", f_status_set_fine(status));
- macro_fss_basic_read_depths_delete(status2, depths);
+ macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
return status;
}
status = fss_basic_read_main_process_file(arguments, data, "-", depths);
if (f_status_is_error(status)) {
- macro_fss_basic_read_depths_delete(status2, depths);
+ macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
return status;
}
// Clear buffers before continuing.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
}
if (data->remaining.used > 0) {
if (f_status_is_error(status)) {
fss_basic_read_print_file_error(data->context, "f_file_open", arguments.argv[data->remaining.array[counter]], f_status_set_fine(status));
- macro_fss_basic_read_depths_delete(status2, depths);
+ macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
return status;
}
if (f_status_is_error(status)) {
fss_basic_read_print_file_error(data->context, "fl_file_read", arguments.argv[data->remaining.array[counter]], f_status_set_fine(status));
- macro_fss_basic_read_depths_delete(status2, depths);
+ macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
return status;
}
status = fss_basic_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths);
if (f_status_is_error(status)) {
- macro_fss_basic_read_depths_delete(status2, depths);
+ macro_fss_basic_read_depths_delete_simple(depths);
fss_basic_read_delete_data(data);
return status;
}
// Clear buffers before repeating the loop.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
} // for
}
- macro_fss_basic_read_depths_delete(status2, depths);
+ macro_fss_basic_read_depths_delete_simple(depths);
}
else {
fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you failed to specify one or more files.");
f_string_length i = 0;
while (i < fss_basic_read_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- 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_string_lengths_delete(status, data->remaining);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
+ f_macro_string_lengths_delete_simple(data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
#ifndef _di_fss_basic_read_main_process_file_
f_return_status fss_basic_read_main_process_file(const f_console_arguments arguments, fss_basic_read_data *data, const f_string filename, const fss_basic_read_depths depths) {
f_status status = f_none;
- f_status status2 = f_none;
{
f_string_location input = f_string_location_initialize;
}
else if (status == f_no_data_on_stop || status == f_no_data_on_eos) {
// Clear buffers, then attempt the next file.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
return f_status_set_warning(status);
}
f_string_length name_length = 0;
for (f_string_length i = 0; i < data->objects.used; i++) {
- name_length = data->objects.array[i].stop - data->objects.array[i].start + 1;
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
if (name_length == argv_length) {
if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name, name_length, argv_length) == f_equal_to) {
* A structure of parameters applied at some depth.
*
* depth: the depth number in which this is to be processed at.
- * parameter: the index representing the parameter enum of either the "at" parameter or the "name" parameter.
- * position: the parameter position index within the argv representing the value associated with the designated parameter.
+ *
+ * index_at: position of the "--at" parameter value in the argv list, when 0 there is no parameter.
+ * index_name: position of the "--name" parameter value in the argv list, when 0 there is no parameter.
+ *
+ * value_at: the value of the "--at" parameter, already processed and ready to use, only when index_at > 0.
+ * value_name: the value of the "--name" parameter, already processed and ready to use, only when index_name > 0.
*/
#ifndef _di_fss_basic_read_depth_
typedef struct {
#define macro_fss_basic_read_depths_new(status, depths, length) f_macro_memory_structure_new(status, depths, fss_basic_read_depth, length)
- #define macro_fss_basic_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_basic_read_depth)
+ #define macro_fss_basic_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_basic_read_depth)
#define macro_fss_basic_read_depths_destroy(status, depths) f_macro_memory_structure_destroy(status, depths, fss_basic_read_depth)
+ #define macro_fss_basic_read_depths_delete_simple(depths) f_macro_memory_structure_delete_simple(depths, fss_basic_read_depth)
+ #define macro_fss_basic_read_depths_destroy_simple(depths) f_macro_memory_structure_destroy_simple(depths, fss_basic_read_depth)
+
#define macro_fss_basic_read_depths_resize(status, depths, new_length) f_macro_memory_structure_resize(status, depths, fss_basic_read_depth, new_length)
#define macro_fss_basic_read_depths_adjust(status, depths, new_length) f_macro_memory_structure_adjust(status, depths, fss_basic_read_depth, new_length)
#endif // _di_fss_basic_read_depths_
fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
}
- f_status status2 = f_none;
-
- f_macro_string_dynamic_delete(status2, input);
+ f_macro_string_dynamic_delete_simple(input);
fss_basic_write_delete_data(data);
return f_status_set_error(status);
}
}
}
- f_macro_string_dynamic_delete(status, input);
+ f_macro_string_dynamic_delete_simple(input);
}
else if (data->parameters[fss_basic_write_parameter_string].result == f_console_result_additional) {
f_string_dynamic input = f_string_dynamic_initialize;
f_string_length i = 0;
while (i < fss_basic_write_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- f_macro_string_lengths_delete(status, data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ f_macro_string_lengths_delete_simple(data->remaining);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
}
fss_extended_read_depths depths = fss_extended_read_depths_initialize;
- f_status status2 = f_none;
f_string_length counter = 0;
f_string_length original_size = data->file_position.total_elements;
status = fss_extended_read_main_preprocess_depth(arguments, *data, &depths);
if (f_status_is_error(status)) {
- macro_fss_extended_read_depths_delete(status2, depths);
+ macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
return status;
}
// This standard does not support nesting, so any depth greater than 0 can be predicted without processing the file.
- if (depths.used > 0 && depths.array[0].depth > 0) {
+ if (depths.array[0].depth > 0) {
if (data->parameters[fss_extended_read_parameter_total].result == f_console_result_found) {
fprintf(f_standard_output, "0%c", f_string_eol);
return f_none;
if (f_status_is_error(status)) {
fss_extended_read_print_file_error(data->context, "fl_file_read_fifo", "-", f_status_set_fine(status));
- macro_fss_extended_read_depths_delete(status2, depths);
+ macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
return status;
}
status = fss_extended_read_main_process_file(arguments, data, "-", depths);
if (f_status_is_error(status)) {
- macro_fss_extended_read_depths_delete(status2, depths);
+ macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
return status;
}
// Clear buffers before continuing.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
}
if (data->remaining.used > 0) {
if (f_status_is_error(status)) {
fss_extended_read_print_file_error(data->context, "f_file_open", arguments.argv[data->remaining.array[counter]], f_status_set_fine(status));
- macro_fss_extended_read_depths_delete(status2, depths);
+ macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
return status;
}
if (f_status_is_error(status)) {
fss_extended_read_print_file_error(data->context, "fl_file_read", arguments.argv[data->remaining.array[counter]], f_status_set_fine(status));
- macro_fss_extended_read_depths_delete(status2, depths);
+ macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
return status;
}
status = fss_extended_read_main_process_file(arguments, data, arguments.argv[data->remaining.array[counter]], depths);
if (f_status_is_error(status)) {
- macro_fss_extended_read_depths_delete(status2, depths);
+ macro_fss_extended_read_depths_delete_simple(depths);
fss_extended_read_delete_data(data);
return status;
}
// Clear buffers before repeating the loop.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
} // for
}
- macro_fss_extended_read_depths_delete(status2, depths);
+ macro_fss_extended_read_depths_delete_simple(depths);
}
else {
fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "ERROR: you failed to specify one or more files.");
f_string_length i = 0;
while (i < fss_extended_read_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- 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_string_lengths_delete(status, data->remaining);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
+ f_macro_string_lengths_delete_simple(data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
#ifndef _di_fss_extended_read_main_process_file_
f_return_status fss_extended_read_main_process_file(const f_console_arguments arguments, fss_extended_read_data *data, const f_string filename, const fss_extended_read_depths depths) {
f_status status = f_none;
- f_status status2 = f_none;
{
f_string_location input = f_string_location_initialize;
}
else if (status == f_no_data_on_stop || status == f_no_data_on_eos) {
// Clear buffers, then attempt the next file.
- f_macro_fss_contents_delete(status2, data->contents);
- f_macro_fss_objects_delete(status2, data->objects);
- f_macro_string_dynamic_delete(status2, data->buffer);
+ f_macro_fss_contents_delete_simple(data->contents);
+ f_macro_fss_objects_delete_simple(data->objects);
+ f_macro_string_dynamic_delete_simple(data->buffer);
return f_status_set_warning(status);
}
f_string_length name_length = 0;
for (f_string_length i = 0; i < data->objects.used; i++) {
- name_length = data->objects.array[i].stop - data->objects.array[i].start + 1;
+ name_length = (data->objects.array[i].stop - data->objects.array[i].start) + 1;
if (name_length == argv_length) {
if (fl_string_compare(data->buffer.string + data->objects.array[i].start, depths.array[0].value_name, name_length, argv_length) == f_equal_to) {
* A structure of parameters applied at some depth.
*
* depth: the depth number in which this is to be processed at.
- * parameter: the index representing the parameter enum of either the "at" parameter or the "name" parameter.
- * position: the parameter position index within the argv representing the value associated with the designated parameter.
+ *
+ * index_at: position of the "--at" parameter value in the argv list, when 0 there is no parameter.
+ * index_name: position of the "--name" parameter value in the argv list, when 0 there is no parameter.
+ *
+ * value_at: the value of the "--at" parameter, already processed and ready to use, only when index_at > 0.
+ * value_name: the value of the "--name" parameter, already processed and ready to use, only when index_name > 0.
*/
#ifndef _di_fss_extended_read_depth_
typedef struct {
#define macro_fss_extended_read_depths_new(status, depths, length) f_macro_memory_structure_new(status, depths, fss_extended_read_depth, length)
- #define macro_fss_extended_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_extended_read_depth)
+ #define macro_fss_extended_read_depths_delete(status, depths) f_macro_memory_structure_delete(status, depths, fss_extended_read_depth)
#define macro_fss_extended_read_depths_destroy(status, depths) f_macro_memory_structure_destroy(status, depths, fss_extended_read_depth)
+ #define macro_fss_extended_read_depths_delete_simple(depths) f_macro_memory_structure_delete_simple(depths, fss_extended_read_depth)
+ #define macro_fss_extended_read_depths_destroy_simple(depths) f_macro_memory_structure_destroy_simple(depths, fss_extended_read_depth)
+
#define macro_fss_extended_read_depths_resize(status, depths, new_length) f_macro_memory_structure_resize(status, depths, fss_extended_read_depth, new_length)
#define macro_fss_extended_read_depths_adjust(status, depths, new_length) f_macro_memory_structure_adjust(status, depths, fss_extended_read_depth, new_length)
#endif // _di_fss_extended_read_depths_
fl_color_print_line(f_standard_error, data->context.error, data->context.reset, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling f_file_open()", status);
}
- f_status status2 = f_none;
-
- f_macro_string_dynamic_delete(status2, input);
+ f_macro_string_dynamic_delete_simple(input);
fss_extended_write_delete_data(data);
return f_status_set_error(status);
}
}
}
- f_macro_string_dynamic_delete(status, input);
+ f_macro_string_dynamic_delete_simple(input);
}
else if (data->parameters[fss_extended_write_parameter_string].result == f_console_result_additional) {
f_string_dynamic input = f_string_dynamic_initialize;
f_string_length i = 0;
while (i < fss_extended_write_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- f_macro_string_lengths_delete(status, data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ f_macro_string_lengths_delete_simple(data->remaining);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
#ifndef _di_fss_status_code_delete_data_
f_return_status fss_status_code_delete_data(fss_status_code_data *data) {
- f_status status = f_none;
f_string_length i = 0;
while (i < fss_status_code_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- f_macro_string_lengths_delete(status, data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ f_macro_string_lengths_delete_simple(data->remaining);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}
#ifndef _di_init_rules_process_main_
f_return_status init_rules_process_main(const init_data data, const f_string filename, f_string_dynamic *buffer, f_fss_objects *objects, f_fss_contents *contents) {
f_status status = f_none;
- f_status status2 = f_none;
// @todo: resume replacing code below.
status = fll_fss_extended_read(&buffer, input, &local->rule_objects, &local->rule_contents);
fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status);
}
- f_macro_fss_objects_delete(status2, local->rule_objects);
- f_macro_fss_contents_delete(status2, local->rule_contents);
+ f_macro_fss_objects_delete_simple(local->rule_objects);
+ f_macro_fss_contents_delete_simple(local->rule_contents);
return f_status_set_error(status);
}
}
- f_macro_fss_objects_delete(status2, local->rule_objects);
- f_macro_fss_contents_delete(status2, local->rule_contents);
+ f_macro_fss_objects_delete_simple(local->rule_objects);
+ f_macro_fss_contents_delete_simple(local->rule_contents);
return status;
}
#endif // _init_rules_process_main_
/*
f_status status = f_none;
- f_status status2 = f_none;
status = fll_fss_extended_read(buffer, location, objects, contents);
fl_color_print_line(f_standard_error, data.context.error, data.context.reset, "INTERNAL ERROR: An unhandled error (%u) has occurred while calling firewall_perform_commands().", status);
}
- f_macro_fss_objects_delete(status2, (*rule_objects));
- f_macro_fss_contents_delete(status2, (*rule_contents));
+ f_macro_fss_objects_delete_simple((*rule_objects));
+ f_macro_fss_contents_delete_simple((*rule_contents));
return f_status_set_error(status);
}
}
}
}
- f_macro_fss_objects_delete(status2, (*rule_objects));
- f_macro_fss_contents_delete(status2, (*rule_contents));
+ f_macro_fss_objects_delete_simple((*rule_objects));
+ f_macro_fss_contents_delete_simple((*rule_contents));
*/
/*
f_macro_string_dynamic_delete(buffer);
f_string_length i = 0;
while (i < status_code_total_parameters) {
- f_macro_string_lengths_delete(status, data->parameters[i].locations);
- f_macro_string_lengths_delete(status, data->parameters[i].additional);
+ f_macro_string_lengths_delete_simple(data->parameters[i].locations);
+ f_macro_string_lengths_delete_simple(data->parameters[i].additional);
i++;
} // while
- f_macro_string_lengths_delete(status, data->remaining);
- fl_macro_color_context_delete(status, data->context);
+ f_macro_string_lengths_delete_simple(data->remaining);
+ fl_macro_color_context_delete_simple(data->context);
return f_none;
}