The more recent practices being followed are having constants on the left and pointers on the right.
The f_memory functions appear to be well followed and the update to this turned out pretty easy.
Despite how many things depend on memory operations in this project, there is actually very little to change.
I consider this a small victory in how my project is designed and intended to be used.
// There is no reason to include "." and ".." in the directory listing.
if (!strncmp(listing[i]->d_name, "..", 3) || !strncmp(listing[i]->d_name, ".", 2)) {
- f_memory_delete((void **) & listing[i], sizeof(char *), size);
+ f_memory_delete(size, sizeof(char *), (void **) & listing[i]);
continue;
}
memcpy(names->array[names->used].string, listing[i]->d_name, size);
names->array[names->used++].used = size;
- f_memory_delete((void **) & listing[i], sizeof(char *), size);
+ f_memory_delete(size, sizeof(char *), (void **) & listing[i]);
} // for
for (; i < length; i++) {
- f_memory_delete((void **) & listing[i], sizeof(char *), size);
+ f_memory_delete(size, sizeof(char *), (void **) & listing[i]);
} // for
- f_memory_delete((void **) & listing, sizeof(struct dirent *), 1);
+ f_memory_delete(1, sizeof(struct dirent *), (void **) & listing);
if (F_status_is_error(status)) return status;
if (!length) return F_data_not;
if (F_status_is_error(status)) break; \
} \
} \
- if (status == F_none) status = f_memory_resize((void **) & structures.array, sizeof(f_directory_status_t), structures.size, new_length); \
+ if (status == F_none) status = f_memory_resize(structures.size, new_length, sizeof(f_directory_status_t), (void **) & structures.array); \
if (status == F_none) { \
structures.size = new_length; \
if (structures.used > structures.size) structures.used = new_length; \
if (F_status_is_error(status)) break; \
} \
} \
- if (status == F_none) status = f_memory_adjust((void **) & structures.array, sizeof(f_directory_status_t), structures.size, new_length); \
+ if (status == F_none) status = f_memory_adjust(structures.size, new_length, sizeof(f_directory_status_t), (void **) & structures.array); \
if (status == F_none) { \
structures.size = new_length; \
if (structures.used > structures.size) structures.used = new_length; \
f_macro_directory_status_t_delete_simple(structures.array[structures.used]); \
} \
if (!structures.size) { \
- if (f_memory_resize((void **) & structures.array, sizeof(f_directory_status_t), structures.size, 0)) { \
+ if (f_memory_resize(structures.size, 0, sizeof(f_directory_status_t), (void **) & structures.array)) { \
structures.size = 0; \
} \
}
f_macro_directory_status_t_destroy_simple(structures.array[structures.used]); \
} \
if (!structures.size) { \
- if (f_memory_adjust((void **) & structures.array, sizeof(f_directory_status_t), structures.size, 0)) { \
+ if (f_memory_adjust(structures.size, 0, sizeof(f_directory_status_t), (void **) & structures.array)) { \
structures.size = 0; \
} \
}
* An array of f_fss_comment_t.
*
* array: the array of fss quote.
- * size: total amount of allocated space.
- * used: total number of allocated spaces used.
+ * size: total amount of allocated space.
+ * used: total number of allocated spaces used.
*/
#ifndef _di_f_fss_comments_t_
typedef f_string_ranges_t f_fss_comments_t;
* An array of f_fss_comments_t.
*
* array: the array of fss quotes.
- * size: total amount of allocated space.
- * used: total number of allocated spaces used.
+ * size: total amount of allocated space.
+ * used: total number of allocated spaces used.
*/
#ifndef _di_f_fss_commentss_t_
typedef f_string_rangess_t f_fss_commentss_t;
* An array of f_fss_delimit_t.
*
* array: the array of fss quote.
- * size: total amount of allocated space.
- * used: total number of allocated spaces used.
+ * size: total amount of allocated space.
+ * used: total number of allocated spaces used.
*/
#ifndef _di_f_fss_delimits_t_
typedef f_string_lengths_t f_fss_delimits_t;
* An array of f_fss_delimits_t.
*
* array: the array of fss quotes.
- * size: total amount of allocated space.
- * used: total number of allocated spaces used.
+ * size: total amount of allocated space.
+ * used: total number of allocated spaces used.
*/
#ifndef _di_f_fss_delimitss_t_
typedef f_string_lengthss_t f_fss_delimitss_t;
f_macro_fss_item_t_adjust(status, items->array[i], 0)
} // for
- status = f_memory_adjust((void **) & items->array, sizeof(f_fss_item_t), items->size, length);
+ status = f_memory_adjust(items->size, length, sizeof(f_fss_item_t), (void **) & items->array);
if (F_status_is_error_not(status)) {
items->size = length;
f_macro_fss_item_t_resize(status, items->array[i], 0)
} // for
- status = f_memory_resize((void **) & items->array, sizeof(f_fss_item_t), items->size, length);
+ status = f_memory_resize(items->size, length, sizeof(f_fss_item_t), (void **) & items->array);
if (F_status_is_error_not(status)) {
items->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & nameds->array, sizeof(f_fss_named_t), nameds->size, length);
+ status = f_memory_adjust(nameds->size, length, sizeof(f_fss_named_t), (void **) & nameds->array);
if (F_status_is_error_not(status)) {
nameds->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & nameds->array, sizeof(f_fss_named_t), nameds->size, length);
+ status = f_memory_resize(nameds->size, length, sizeof(f_fss_named_t), (void **) & nameds->array);
if (F_status_is_error_not(status)) {
nameds->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & nest->depth, sizeof(f_fss_items_t), nest->size, length);
+ status = f_memory_adjust(nest->size, length, sizeof(f_fss_items_t), (void **) & nest->depth);
if (F_status_is_error_not(status)) {
nest->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & nest->depth, sizeof(f_fss_items_t), nest->size, length);
+ status = f_memory_resize(nest->size, length, sizeof(f_fss_items_t), (void **) & nest->depth);
if (F_status_is_error_not(status)) {
nest->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & nests->array, sizeof(f_fss_nest_t), nests->size, length);
+ status = f_memory_adjust(nests->size, length, sizeof(f_fss_nest_t), (void **) & nests->array);
if (F_status_is_error_not(status)) {
nests->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & nests->array, sizeof(f_fss_nest_t), nests->size, length);
+ status = f_memory_resize(nests->size, length, sizeof(f_fss_nest_t), (void **) & nests->array);
if (F_status_is_error_not(status)) {
nests->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & set_quotes->array, sizeof(f_fss_set_quote_t), set_quotes->size, length);
+ status = f_memory_adjust(set_quotes->size, length, sizeof(f_fss_set_quote_t), (void **) & set_quotes->array);
if (F_status_is_error_not(status)) {
set_quotes->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & set_quotes->array, sizeof(f_fss_set_quote_t), set_quotes->size, length);
+ status = f_memory_resize(set_quotes->size, length, sizeof(f_fss_set_quote_t), (void **) & set_quotes->array);
if (F_status_is_error_not(status)) {
set_quotes->size = length;
if (F_status_is_error(status)) return status;
} // for
- f_memory_adjust((void **) & sets->array, sizeof(f_fss_set_t), sets->size, length);
+ f_memory_adjust(sets->size, length, sizeof(f_fss_set_t), (void **) & sets->array);
if (F_status_is_error_not(status)) {
sets->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & sets->array, sizeof(f_fss_set_t), sets->size, length);
+ status = f_memory_resize(sets->size, length, sizeof(f_fss_set_t), (void **) & sets->array);
if (F_status_is_error_not(status)) {
sets->size = length;
#endif
#ifndef _di_f_memory_adjust_
- f_status_t f_memory_adjust(void **pointer, const size_t size, const size_t old_length, const size_t new_length) {
+ f_status_t f_memory_adjust(const size_t old_length, const size_t new_length, const size_t size, void **pointer) {
#ifndef _di_level_0_parameter_checking_
if (!size) return F_status_set_error(F_parameter);
if (!pointer) return F_status_set_error(F_parameter);
#endif // _di_f_memory_adjust_-#ifndef _di_f_memory_delete_
#ifndef _di_f_memory_delete_
- f_status_t f_memory_delete(void **pointer, const size_t size, const size_t length) {
+ f_status_t f_memory_delete(const size_t length, const size_t size, void **pointer) {
#ifndef _di_level_0_parameter_checking_
if (!pointer) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
#endif // _di_f_memory_delete_
#ifndef _di_f_memory_destroy_
- f_status_t f_memory_destroy(void **pointer, const size_t size, const size_t length) {
+ f_status_t f_memory_destroy(const size_t length, const size_t size, void **pointer) {
#ifndef _di_level_0_parameter_checking_
if (!size) return F_status_set_error(F_parameter);
if (!pointer) return F_status_set_error(F_parameter);
#endif // _di_f_memory_destroy_
#ifndef _di_f_memory_new_
- f_status_t f_memory_new(void **pointer, const size_t size, const size_t length) {
+ f_status_t f_memory_new(const size_t length, const size_t size, void **pointer) {
#ifndef _di_level_0_parameter_checking_
if (!size) return F_status_set_error(F_parameter);
if (!pointer) return F_status_set_error(F_parameter);
#ifndef _di_f_memory_new_aligned_
- f_status_t f_memory_new_aligned(void **pointer, const size_t alignment, const size_t length) {
+ f_status_t f_memory_new_aligned(const size_t length, const size_t alignment, void **pointer) {
#ifndef _di_level_0_parameter_checking_
if (!alignment) return F_status_set_error(F_parameter);
if (!pointer) return F_status_set_error(F_parameter);
#endif // _di_f_memory_new_aligned_
#ifndef _di_f_memory_resize_
- f_status_t f_memory_resize(void **pointer, const size_t size, const size_t old_length, const size_t new_length) {
+ f_status_t f_memory_resize(const size_t old_length, const size_t new_length, const size_t size, void **pointer) {
#ifndef _di_level_0_parameter_checking_
if (!size) return F_status_set_error(F_parameter);
if (!pointer) return F_status_set_error(F_parameter);
*
* Will change all data to 0 prior to deallocation.
*
- * @param pointer
- * A pointer to the address that will be resized.
- * @param size
- * The block size, in bytes (size * length = allocated size).
* @param old_length
* The total number of blocks representing the length to be resized from.
* @param new_length
* The total number of blocks representing the length to be resized to.
+ * @param size
+ * The block size, in bytes (size * length = allocated size).
+ * @param pointer
+ * A pointer to the address that will be resized.
*
* @return
* F_none on success.
* @see realloc()
*/
#ifndef _di_f_memory_adjust_
- extern f_status_t f_memory_adjust(void **pointer, const size_t size, const size_t old_length, const size_t new_length);
+ extern f_status_t f_memory_adjust(const size_t old_length, const size_t new_length, const size_t size, void **pointer);
#endif // _di_f_memory_adjust_
/**
*
* Type and length are not normally used by this function but must be provided for the cases when f_memory_delete is swapped with f_memory_destroy (or vice-versa).
*
- * @param pointer
- * A pointer to the address that will be freed.
- * @param size
- * The block size, in bytes (size * length = allocated size).
- * If size is 0 then no delete is performed.
* @param length
* The total number of blocks to be allocated.
* If length is 0 then no delete is performed.
+ * @param size
+ * The block size, in bytes (size * length = allocated size).
+ * If size is 0 then no delete is performed.
+ * @param pointer
+ * A pointer to the address that will be freed.
*
* @return
* F_none on success.
* @see free()
*/
#ifndef _di_f_memory_delete_
- extern f_status_t f_memory_delete(void **pointer, const size_t size, const size_t length);
+ extern f_status_t f_memory_delete(const size_t length, const size_t size, void **pointer);
#endif // _di_f_memory_delete_
/**
*
* Will change all data to 0 prior to deallocation.
*
- * @param pointer
- * A pointer to the address that will be freed.
- * @param size
- * The block size, in bytes (size * length = allocated size).
- * If size is 0 then no delete is performed.
* @param length
* The total number of blocks to be allocated.
* If length is 0 then no delete is performed.
+ * @param size
+ * The block size, in bytes (size * length = allocated size).
+ * If size is 0 then no delete is performed.
+ * @param pointer
+ * A pointer to the address that will be freed.
*
* @return
* F_none on success.
* @see memset()
*/
#ifndef _di_f_memory_destroy_
- extern f_status_t f_memory_destroy(void **pointer, const size_t size, const size_t length);
+ extern f_status_t f_memory_destroy(const size_t length, const size_t size, void **pointer);
#endif // _di_f_memory_destroy_
/**
* @see memset()
*/
#ifndef _di_f_memory_new_
- extern f_status_t f_memory_new(void **pointer, const size_t size, const size_t length);
+ extern f_status_t f_memory_new(const size_t length, const size_t size, void **pointer);
#endif // _di_f_memory_new_
/**
* Create some dynamically allocated array of some length, guaranteeing aligned memory.
*
- * @param pointer
- * A pointer that will be updated to the address of the newly allocated memory.
- * @param alignment
- * The size of the alignment, such as sizeof(void *).
- * Must be greater than 0.
* @param length
* The total number of blocks to be allocated.
* Must be greater than 0.
* Must be a multiple of alignment.
+ * @param alignment
+ * The size of the alignment, such as sizeof(void *).
+ * Must be greater than 0.
+ * @param pointer
+ * A pointer that will be updated to the address of the newly allocated memory.
*
* @return
* F_none on success.
* @see memset()
*/
#ifndef _di_f_memory_new_aligned_
- extern f_status_t f_memory_new_aligned(void **pointer, const size_t alignment, const size_t length);
+ extern f_status_t f_memory_new_aligned(const size_t length, const size_t alignment, void **pointer);
#endif // _di_f_memory_new_aligned_
/**
*
* Will not change any of the data prior to deallocation.
*
- * @param pointer
- * A pointer to the address that will be resized.
- * @param size
- * The block size, in bytes (size * length = allocated size).
* @param old_length
* The total number of blocks representing the length to be resized from.
* @param new_length
* The total number of blocks representing the length to be resized to.
+ * @param size
+ * The block size, in bytes (size * length = allocated size).
+ * @param pointer
+ * A pointer to the address that will be resized.
*
* @return
* F_none on success.
* @see realloc()
*/
#ifndef _di_f_memory_resize_
- extern f_status_t f_memory_resize(void **pointer, const size_t size, const size_t old_length, const size_t new_length);
+ extern f_status_t f_memory_resize(const size_t old_length, const size_t new_length, const size_t size, void **pointer);
#endif // _di_f_memory_resize_
#ifdef __cplusplus
#if !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_)
f_status_t private_f_string_dynamic_adjust(const f_string_length_t length, f_string_dynamic_t *dynamic) {
- f_status_t status = f_memory_adjust((void **) & dynamic->string, sizeof(f_string_t), dynamic->size, length);
+ f_status_t status = f_memory_adjust(dynamic->size, length, sizeof(f_string_t), (void **) & dynamic->string);
if (F_status_is_error_not(status)) {
dynamic->size = length;
#if !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_)
f_status_t private_f_string_dynamic_resize(const f_string_length_t length, f_string_dynamic_t *dynamic) {
- const f_status_t status = f_memory_resize((void **) & dynamic->string, sizeof(f_string_t), dynamic->size, length);
+ const f_status_t status = f_memory_resize(dynamic->size, length, sizeof(f_string_t), (void **) & dynamic->string);
if (F_status_is_error_not(status)) {
dynamic->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & dynamics->array, sizeof(f_string_dynamic_t), dynamics->size, length);
+ status = f_memory_adjust(dynamics->size, length, sizeof(f_string_dynamic_t), (void **) & dynamics->array);
if (F_status_is_error_not(status)) {
dynamics->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & dynamics->array, sizeof(f_string_dynamic_t), dynamics->size, length);
+ status = f_memory_resize(dynamics->size, length, sizeof(f_string_dynamic_t), (void **) & dynamics->array);
if (F_status_is_error_not(status)) {
dynamics->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & map_multis->array, sizeof(f_string_map_multi_t), map_multis->size, length);
+ status = f_memory_adjust(map_multis->size, length, sizeof(f_string_map_multi_t), (void **) & map_multis->array);
if (F_status_is_error_not(status)) {
map_multis->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & map_multis->array, sizeof(f_string_map_multi_t), map_multis->size, length);
+ status = f_memory_resize(map_multis->size, length, sizeof(f_string_map_multi_t), (void **) & map_multis->array);
if (F_status_is_error_not(status)) {
map_multis->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & maps->array, sizeof(f_string_map_t), maps->size, length);
+ status = f_memory_adjust(maps->size, length, sizeof(f_string_map_t), (void **) & maps->array);
if (F_status_is_error_not(status)) {
maps->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & maps->array, sizeof(f_string_map_t), maps->size, length);
+ status = f_memory_resize(maps->size, length, sizeof(f_string_map_t), (void **) & maps->array);
if (F_status_is_error_not(status)) {
maps->size = length;
#if !defined(_di_f_string_quantitys_adjust_) || !defined(_di_f_string_quantitys_decimate_by_)
f_status_t private_f_string_quantitys_adjust(const f_string_length_t length, f_string_quantitys_t *quantitys) {
- const f_status_t status = f_memory_adjust((void **) & quantitys->array, sizeof(f_string_quantity_t), quantitys->size, length);
+ const f_status_t status = f_memory_adjust(quantitys->size, length, sizeof(f_string_quantity_t), (void **) & quantitys->array);
if (F_status_is_error_not(status)) {
quantitys->size = length;
#if !defined(_di_f_string_quantitys_decrease_) || !defined(_di_f_string_quantitys_decrease_by_) || !defined(_di_f_string_quantitys_increase_) || !defined(_di_f_string_quantitys_increase_by_) || !defined(_di_f_string_quantitys_terminate_) || !defined(_di_f_string_quantitys_terminate_after_)
f_status_t private_f_string_quantitys_resize(const f_string_length_t length, f_string_quantitys_t *quantitys) {
- const f_status_t status = f_memory_resize((void **) & quantitys->array, sizeof(f_string_quantity_t), quantitys->size, length);
+ const f_status_t status = f_memory_resize(quantitys->size, length, sizeof(f_string_quantity_t), (void **) & quantitys->array);
if (F_status_is_error_not(status)) {
quantitys->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & quantityss->array, sizeof(f_string_quantitys_t), quantityss->size, length);
+ status = f_memory_adjust(quantityss->size, length, sizeof(f_string_quantitys_t), (void **) & quantityss->array);
if (F_status_is_error_not(status)) {
quantityss->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & quantityss->array, sizeof(f_string_quantitys_t), quantityss->size, length);
+ status = f_memory_resize(quantityss->size, length, sizeof(f_string_quantitys_t), (void **) & quantityss->array);
if (F_status_is_error_not(status)) {
quantityss->size = length;
#if !defined(_di_f_string_ranges_adjust_) || !defined(_di_f_string_ranges_decimate_by_)
f_status_t private_f_string_ranges_adjust(const f_string_length_t length, f_string_ranges_t *ranges) {
- const f_status_t status = f_memory_adjust((void **) & ranges->array, sizeof(f_string_range_t), ranges->size, length);
+ const f_status_t status = f_memory_adjust(ranges->size, length, sizeof(f_string_range_t), (void **) & ranges->array);
if (F_status_is_error_not(status)) {
ranges->size = length;
#if !defined(_di_f_string_ranges_decrease_) || !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_terminate_) || !defined(_di_f_string_ranges_terminate_after_)
f_status_t private_f_string_ranges_resize(const f_string_length_t length, f_string_ranges_t *ranges) {
- const f_status_t status = f_memory_resize((void **) & ranges->array, sizeof(f_string_range_t), ranges->size, length);
+ const f_status_t status = f_memory_resize(ranges->size, length, sizeof(f_string_range_t), (void **) & ranges->array);
if (F_status_is_error_not(status)) {
ranges->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & rangess->array, sizeof(f_string_ranges_t), rangess->size, length);
+ status = f_memory_adjust(rangess->size, length, sizeof(f_string_ranges_t), (void **) & rangess->array);
if (F_status_is_error_not(status)) {
rangess->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & rangess->array, sizeof(f_string_ranges_t), rangess->size, length);
+ status = f_memory_resize(rangess->size, length, sizeof(f_string_ranges_t), (void **) & rangess->array);
if (F_status_is_error_not(status)) {
rangess->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_adjust((void **) & triples->array, sizeof(f_string_triple_t), triples->size, length);
+ status = f_memory_adjust(triples->size, length, sizeof(f_string_triple_t), (void **) & triples->array);
if (F_status_is_error_not(status)) {
triples->size = length;
if (F_status_is_error(status)) return status;
} // for
- status = f_memory_resize((void **) & triples->array, sizeof(f_string_triple_t), triples->size, length);
+ status = f_memory_resize(triples->size, length, sizeof(f_string_triple_t), (void **) & triples->array);
if (F_status_is_error_not(status)) {
triples->size = length;
#define f_macro_string_t_clear(string) string = 0;
- #define f_macro_string_t_resize(status, string, length_old, length_new) status = f_memory_resize((void **) & string, sizeof(f_string_t), length_old, length_new);
- #define f_macro_string_t_adjust(status, string, length_old, length_new) status = f_memory_adjust((void **) & string, sizeof(f_string_t), length_old, length_new);
+ #define f_macro_string_t_resize(status, string, length_old, length_new) status = f_memory_resize(length_old, length_new, sizeof(f_string_t), (void **) & string);
+ #define f_macro_string_t_adjust(status, string, length_old, length_new) status = f_memory_adjust(length_old, length_new, sizeof(f_string_t), (void **) & string);
- #define f_macro_string_t_delete_simple(string, length) f_memory_resize((void **) & string, sizeof(f_string_t), length, 0);
- #define f_macro_string_t_destroy_simple(string, length) f_memory_adjust((void **) & string, sizeof(f_string_t), length, 0);
+ #define f_macro_string_t_delete_simple(string, length) f_memory_resize(length, 0, sizeof(f_string_t), (void **) & string);
+ #define f_macro_string_t_destroy_simple(string, length) f_memory_adjust(length, 0, sizeof(f_string_t), (void **) & string);
#endif // _di_f_string_t_
#ifndef _di_f_string_length_t_
#define f_utf_string_t_initialize f_utf_character_t_eos
- #define f_macro_utf_string_t_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_utf_string_t), length);
+ #define f_macro_utf_string_t_new(status, string, length) status = f_memory_new(length, sizeof(f_utf_string_t), (void **) & string);
- #define f_macro_utf_string_t_resize(status, string, old_length, new_length) status = f_memory_resize((void **) & string, sizeof(f_utf_string_t), old_length, new_length);
- #define f_macro_utf_string_t_adjust(status, string, old_length, new_length) status = f_memory_adjust((void **) & string, sizeof(f_utf_string_t), old_length, new_length);
+ #define f_macro_utf_string_t_resize(status, string, old_length, new_length) status = f_memory_resize(old_length, new_length, sizeof(f_utf_string_t), (void **) & string);
+ #define f_macro_utf_string_t_adjust(status, string, old_length, new_length) status = f_memory_adjust(old_length, new_length, sizeof(f_utf_string_t), (void **) & string);
- #define f_macro_utf_string_t_delete(status, string, size) status = f_memory_delete((void **) & string, sizeof(f_utf_string_t), size);
- #define f_macro_utf_string_t_destroy(status, string, size) status = f_memory_destroy((void **) & string, sizeof(f_utf_string_t), size);
+ #define f_macro_utf_string_t_delete(status, string, size) status = f_memory_delete(size, sizeof(f_utf_string_t), (void **) & string);
+ #define f_macro_utf_string_t_destroy(status, string, size) status = f_memory_destroy(size, sizeof(f_utf_string_t), (void **) & string);
#endif // _di_f_utf_string_t_
/**
#define f_utf_string_length_t_size 0xfffffffffffffffe
#define f_utf_string_length_t_size_max f_number_t_size_max_unsigned
- #define f_macro_utf_string_length_t_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_utf_string_length_t), length);
+ #define f_macro_utf_string_length_t_new(status, string, length) status = f_memory_new(length, sizeof(f_utf_string_length_t), (void **) & string);
- #define f_macro_utf_string_length_t_resize(status, length, old_length, new_length) status = f_memory_resize((void **) & length, sizeof(f_utf_string_length_t), old_length, new_length);
- #define f_macro_utf_string_length_t_adjust(status, length, old_length, new_length) status = f_memory_adjust((void **) & length, sizeof(f_utf_string_length_t), old_length, new_length);
+ #define f_macro_utf_string_length_t_resize(status, length, old_length, new_length) status = f_memory_resize(old_length, new_length, sizeof(f_utf_string_length_t), (void **) & length);
+ #define f_macro_utf_string_length_t_adjust(status, length, old_length, new_length) status = f_memory_adjust(old_length, new_length, sizeof(f_utf_string_length_t), (void **) & length);
- #define f_macro_utf_string_length_t_delete(status, string, length) status = f_memory_delete((void **) & string, sizeof(f_utf_string_length_t), length);
- #define f_macro_utf_string_length_t_destroy(status, string, size) status = f_memory_destroy((f_void_P *) & string, sizeof(f_utf_string_length_t), size);
+ #define f_macro_utf_string_length_t_delete(status, string, length) status = f_memory_delete(length, sizeof(f_utf_string_length_t), (void **) & string);
+ #define f_macro_utf_string_length_t_destroy(status, string, size) status = f_memory_destroy(size, sizeof(f_utf_string_length_t), (void **) & string);
#endif // _di_f_utf_string_length_t_
/**
#define f_macro_utf_string_range_t_initialize(length) { length ? 0 : 1, length ? length - 1 : 0 }
- #define f_macro_utf_string_range_t_new(status, utf_string_range, length) status = f_memory_new((void **) & utf_string_range, sizeof(f_utf_string_range_t), length);
+ #define f_macro_utf_string_range_t_new(status, utf_string_range, length) status = f_memory_new(length, sizeof(f_utf_string_range_t), (void **) & utf_string_range);
- #define f_macro_utf_string_range_t_resize(status, utf_string_range, old_length, new_length) status = f_memory_resize((void **) & utf_string_range, sizeof(f_utf_string_range_t), old_length, new_length);
- #define f_macro_utf_string_range_t_adjust(status, utf_string_range, old_length, new_length) status = f_memory_adjust((void **) & utf_string_range, sizeof(f_utf_string_range_t), old_length, new_length);
+ #define f_macro_utf_string_range_t_resize(status, utf_string_range, old_length, new_length) status = f_memory_resize(old_length, new_length, sizeof(f_utf_string_range_t), (void **) & utf_string_range);
+ #define f_macro_utf_string_range_t_adjust(status, utf_string_range, old_length, new_length) status = f_memory_adjust(old_length, new_length, sizeof(f_utf_string_range_t), (void **) & utf_string_range);
- #define f_macro_utf_string_range_t_delete(status, utf_string_range, size) status = f_memory_delete((void **) & utf_string_range, sizeof(f_utf_string_range_t), size);
- #define f_macro_utf_string_range_t_destroy(status, utf_string_range, size) status = f_memory_destroy((void **) & utf_string_range, sizeof(f_utf_string_range_t), size);
+ #define f_macro_utf_string_range_t_delete(status, utf_string_range, size) status = f_memory_delete(size, sizeof(f_utf_string_range_t), (void **) & utf_string_range);
+ #define f_macro_utf_string_range_t_destroy(status, utf_string_range, size) status = f_memory_destroy(size, sizeof(f_utf_string_range_t), (void **) & utf_string_range);
#endif // _di_f_utf_string_range_t_
/**
#define f_macro_utf_string_dynamic_t_new(status, dynamic, new_length) \
f_clear_utf_string_dynamic_t(dynamic) \
- status = f_memory_new((void **) & dynamic.string, sizeof(f_utf_string_t), new_length); \
+ status = f_memory_new(new_length, sizeof(f_utf_string_t), (void **) & dynamic.string); \
if (status == F_none) { \
dynamic.size = new_length; \
dynamic.used = 0; \
}
#define f_macro_utf_string_dynamic_t_resize(status, dynamic, new_length) \
- status = f_memory_resize((void **) & dynamic.string, sizeof(f_utf_string_t), dynamic.size, new_length); \
+ status = f_memory_resize(dynamic.size, new_length, sizeof(f_utf_string_t), (void **) & dynamic.string); \
if (status == F_none) { \
dynamic.size = new_length; \
if (dynamic.used > dynamic.size) dynamic.used = new_length; \
}
#define f_macro_utf_string_dynamic_t_adjust(status, dynamic, new_length) \
- status = f_memory_adjust((void **) & dynamic.string, sizeof(f_utf_string_t), dynamic.size, new_length); \
+ status = f_memory_adjust(dynamic.size, new_length, sizeof(f_utf_string_t), (void **) & dynamic.string); \
if (status == F_none) { \
dynamic.size = new_length; \
if (dynamic.used > dynamic.size) dynamic.used = new_length; \
}
#define f_macro_utf_string_dynamic_t_delete(status, dynamic) \
- status = f_memory_delete((void **) & dynamic.string, sizeof(f_utf_string_t), dynamic.size); \
+ status = f_memory_delete(dynamic.size, sizeof(f_utf_string_t), (void **) & dynamic.string); \
if (status == F_none) { \
dynamic.size = 0; \
dynamic.used = 0; \
}
#define f_macro_utf_string_dynamic_t_destroy(status, dynamic) \
- status = f_memory_destroy((void **) & dynamic.string, sizeof(f_utf_string_t), dynamic.size); \
+ status = f_memory_destroy(dynamic.size, sizeof(f_utf_string_t), (void **) & dynamic.string); \
if (status == F_none) { \
dynamic.size = 0; \
dynamic.used = 0; \
}
#define f_macro_utf_string_dynamic_t_delete_simple(dynamic) \
- f_memory_delete((void **) & dynamic.string, sizeof(f_utf_string_t), dynamic.size); \
+ f_memory_delete(dynamic.size, sizeof(f_utf_string_t), (void **) & dynamic.string); \
dynamic.size = 0; \
dynamic.used = 0;
#define f_macro_utf_string_dynamic_t_destroy_simple(dynamic) \
- f_memory_destroy((void **) & dynamic.string, sizeof(f_utf_string_t), dynamic.size); \
+ f_memory_destroy(dynamic.size, sizeof(f_utf_string_t), (void **) & dynamic.string); \
dynamic.size = 0; \
dynamic.used = 0;
#endif // _di_f_utf_string_dynamic_t_
dynamics.array = 0; \
dynamics.size = 0; \
dynamics.used = 0; \
- status = f_memory_new((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), length); \
+ status = f_memory_new(length, sizeof(f_utf_string_dynamic_t), (void **) & dynamics.array); \
if (status == F_none) { \
dynamics.size = length; \
dynamics.used = 0; \
if (F_status_is_error(status)) break; \
} \
} \
- if (status == F_none) status = f_memory_resize((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), dynamics.size, new_length); \
+ if (status == F_none) status = f_memory_resize(dynamics.size, new_length, sizeof(f_utf_string_dynamic_t), (void **) & dynamics.array); \
if (status == F_none) { \
dynamics.size = new_length; \
if (dynamics.used > dynamics.size) dynamics.used = new_length; \
if (F_status_is_error(status)) break; \
} \
} \
- if (status == F_none) status = f_memory_adjust((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), dynamics.size, new_length); \
+ if (status == F_none) status = f_memory_adjust(dynamics.size, new_length, sizeof(f_utf_string_dynamic_t), (void **) & dynamics.array); \
if (status == F_none) { \
dynamics.size = new_length; \
if (dynamics.used > dynamics.size) dynamics.used = new_length; \
f_macro_utf_string_dynamic_t_destroy(status, dynamics.array[dynamics.size]); \
if (F_status_is_error(status)) break; \
} \
- if (status == F_none) status = f_memory_delete((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), dynamics.size); \
+ if (status == F_none) status = f_memory_delete(dynamics.size, sizeof(f_utf_string_dynamic_t), (void **) & dynamics.array); \
if (status == F_none) dynamics.used = 0;
#define f_macro_utf_string_dynamics_t_destroy(status, dynamics) \
f_macro_utf_string_dynamic_t_destroy(status, dynamics.array[dynamics.size]); \
if (F_status_is_error(status)) break; \
} \
- if (status == F_none) status = f_memory_destroy((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), dynamics.size); \
+ if (status == F_none) status = f_memory_destroy(dynamics.size, sizeof(f_utf_string_dynamic_t), (void **) & dynamics.array); \
if (status == F_none) dynamics.used = 0;
#define f_macro_utf_string_dynamics_t_delete_simple(dynamics) \
dynamics.used--; \
f_macro_string_dynamic_t_delete_simple(dynamics.array[dynamics.used]); \
if (!dynamics.used) { \
- if (f_memory_delete((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), dynamics.size)) { \
+ if (f_memory_delete(dynamics.size, sizeof(f_utf_string_dynamic_t), (void **) & dynamics.array)) { \
dynamics.size = 0; \
} \
} \
dynamics.used--; \
f_macro_string_dynamic_t_destroy_simple(dynamics.array[dynamics.used]); \
if (!dynamics.used) { \
- if (f_memory_destroy((void **) & dynamics.array, sizeof(f_utf_string_dynamic_t), dynamics.size)) { \
+ if (f_memory_destroy(dynamics.size, sizeof(f_utf_string_dynamic_t), (void **) & dynamics.array)) { \
dynamics.size = 0; \
} \
} \
// There is no reason to include "." and ".." in the directory listing.
if (!strncmp(entity[i]->d_name, "..", 3) || !strncmp(entity[i]->d_name, ".", 2)) {
- f_memory_resize((void **) & entity[i], sizeof(char *), 1, 0);
+ f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]);
continue;
}
names->array[names->used].used = size;
names->used++;
- f_memory_resize((void **) & entity[i], sizeof(char *), 1, 0);
+ f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]);
} // for
closedir(parent);
for (; i < length; i++) {
- f_memory_resize((void **) & entity[i], sizeof(char *), 1, 0);
+ f_memory_resize(1, 0, sizeof(char *), (void **) & entity[i]);
} // for
- f_memory_resize((void **) & entity, sizeof(struct dirent *), 1, 0);
+ f_memory_resize(1, 0, sizeof(struct dirent *), (void **) & entity);
if (F_status_is_error(status)) return status;
if (!length) return F_data_not;
actions.used--; \
controller_macro_rule_action_t_delete_simple(actions.array[actions.used]); \
} \
- f_memory_delete((void **) & actions.array, sizeof(controller_rule_action_t), actions.size); \
+ f_memory_delete(actions.size, sizeof(controller_rule_action_t), (void **) & actions.array); \
actions.size = 0;
#endif // _di_controller_rule_actions_t_
items.used--; \
controller_macro_rule_item_t_delete_simple(items.array[items.used]); \
} \
- f_memory_delete((void **) & items.array, sizeof(controller_rule_item_t), items.size); \
+ f_memory_delete(items.size, sizeof(controller_rule_item_t), (void **) & items.array); \
items.size = 0;
#endif // _di_controller_rule_items_t_
rules.used--; \
controller_macro_rule_t_delete_simple(rules.array[rules.used]); \
} \
- f_memory_delete((void **) & rules.array, sizeof(controller_rule_t), rules.size); \
+ f_memory_delete(rules.size, sizeof(controller_rule_t), (void **) & rules.array); \
rules.size = 0;
#endif // _di_controller_rules_t_
actions.used--; \
controller_macro_entry_action_t_delete_simple(actions.array[actions.used]); \
} \
- f_memory_resize((void **) & actions.array, sizeof(controller_entry_action_t), actions.size, 0); \
+ f_memory_resize(actions.size, 0, sizeof(controller_entry_action_t), (void **) & actions.array); \
actions.size = 0;
#endif // _di_controller_entry_actions_t_
items.used--; \
controller_macro_entry_item_t_delete_simple(items.array[items.used]); \
} \
- f_memory_delete((void **) & items.array, sizeof(controller_entry_item_t), items.size); \
+ f_memory_delete(items.size, sizeof(controller_entry_item_t), (void **) & items.array); \
items.size = 0;
#endif // _di_controller_entry_items_t_
return F_status_set_error(F_array_too_large);
}
- const f_status_t status = f_memory_resize((void **) & actions->array, sizeof(controller_entry_action_t), actions->size, actions->used + amount);
+ const f_status_t status = f_memory_resize(actions->size, actions->used + amount, sizeof(controller_entry_action_t), (void **) & actions->array);
if (F_status_is_error_not(status)) {
actions->size = actions->used + amount;
return F_status_set_error(F_array_too_large);
}
- const f_status_t status = f_memory_resize((void **) & items->array, sizeof(controller_entry_item_t), items->size, items->used + amount);
+ const f_status_t status = f_memory_resize(items->size, items->used + amount, sizeof(controller_entry_item_t), (void **) & items->array);
if (F_status_is_error_not(status)) {
items->size = items->used + amount;
return F_status_set_error(F_array_too_large);
}
- const f_status_t status = f_memory_resize((void **) & actions->array, sizeof(controller_rule_action_t), actions->size, actions->used + amount);
+ const f_status_t status = f_memory_resize(actions->size, actions->used + amount, sizeof(controller_rule_action_t), (void **) & actions->array);
if (F_status_is_error_not(status)) {
actions->size = actions->used + amount;
return F_status_set_error(F_array_too_large);
}
- const f_status_t status = f_memory_resize((void **) & items->array, sizeof(controller_rule_item_t), items->size, items->used + amount);
+ const f_status_t status = f_memory_resize(items->size, items->used + amount, sizeof(controller_rule_item_t), (void **) & items->array);
if (F_status_is_error_not(status)) {
items->size = items->used + amount;
size = f_array_length_t_size;
}
- const f_status_t status = f_memory_resize((void **) & rules->array, sizeof(controller_rule_t), rules->size, size);
+ const f_status_t status = f_memory_resize(rules->size, size, sizeof(controller_rule_t), (void **) & rules->array);
if (F_status_is_error_not(status)) {
rules->size = size;
fss_basic_list_read_macro_depth_t_delete_simple(depths.array[i]); \
} \
} \
- if (status == F_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_basic_list_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_resize(depths.size, new_length, sizeof(fss_basic_list_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
fss_basic_list_read_macro_depth_t_delete_simple(depths.array[i]); \
} \
} \
- if (status == F_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_basic_list_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_adjust(depths.size, new_length, sizeof(fss_basic_list_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
if (F_status_is_error(status)) break; \
} \
} \
- if (status == F_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_basic_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_resize(depths.size, new_length, sizeof(fss_basic_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
if (F_status_is_error(status)) break; \
} \
} \
- if (status == F_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_basic_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_adjust(depths.size, new_length, sizeof(fss_basic_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
fss_embedded_list_read_macro_depth_t_delete_simple(depths.array[i]); \
} \
} \
- if (status == F_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_embedded_list_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_resize(depths.size, new_length, sizeof(fss_embedded_list_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
fss_embedded_list_read_macro_depth_t_delete_simple(depths.array[i]); \
} \
} \
- if (status == F_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_embedded_list_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_adjust(depths.size, new_length, sizeof(fss_embedded_list_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
if (F_status_is_error(status)) break; \
} \
} \
- if (status == F_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_extended_list_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_resize(depths.size, new_length, sizeof(fss_extended_list_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
if (F_status_is_error(status)) break; \
} \
} \
- if (status == F_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_extended_list_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_adjust(depths.size, new_length, sizeof(fss_extended_list_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
fss_extended_read_macro_depth_t_delete_simple(depths.array[i]); \
} \
} \
- if (status == F_none) status = f_memory_resize((void **) & depths.array, sizeof(fss_extended_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_resize(depths.size, new_length, sizeof(fss_extended_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \
fss_extended_read_macro_depth_t_delete_simple(depths.array[i]); \
} \
} \
- if (status == F_none) status = f_memory_adjust((void **) & depths.array, sizeof(fss_extended_read_depth_t), depths.size, new_length); \
+ if (status == F_none) status = f_memory_adjust(depths.size, new_length, sizeof(fss_extended_read_depth_t), (void **) & depths.array); \
if (status == F_none) { \
depths.size = new_length; \
if (depths.used > depths.size) depths.used = new_length; \