From 3dee02180d1ab33471e57b17c1485532fee1c597 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 29 Aug 2023 19:11:27 -0500 Subject: [PATCH] Security: Add additional sanity checks before freeing in memory array and fix structure problem in dynamicss callback. Add additional checks to ensure a free() does not get called on a NULL pointer. The dynamics delete and destroy callbacks in particular have the f_memory_array_resize() inside the loop rather than outside the loop. --- level_0/f_account/c/account/accounts.c | 204 +++++++---- level_0/f_directory/c/directory/listing.c | 324 +++++++++++------ level_0/f_directory/c/directory/recurse_do.c | 404 ++++++++++++++------- level_0/f_directory/c/directory/status.c | 28 +- level_0/f_fss/c/fss/item.c | 28 +- level_0/f_fss/c/fss/named.c | 116 ++++-- level_0/f_fss/c/fss/nest.c | 72 ++-- level_0/f_fss/c/fss/set.c | 80 ++-- level_0/f_fss/c/fss/set_quote.c | 164 ++++++--- level_0/f_fss/c/fss/simple_packet.c | 32 +- level_0/f_fss/c/fss/simple_packet.h | 1 + level_0/f_iki/c/iki/data.c | 212 +++++++---- level_0/f_limit/c/limit/set.c | 4 +- level_0/f_limit/c/limit/value.c | 4 +- level_0/f_socket/c/socket/address.c | 4 +- level_0/f_socket/c/socket/socket.c | 4 +- level_0/f_string/c/string/dynamics.c | 4 +- level_0/f_string/c/string/dynamicss.c | 8 +- level_0/f_string/c/string/map_multis.c | 20 +- level_0/f_string/c/string/map_multiss.c | 22 +- level_0/f_string/c/string/maps.c | 8 +- level_0/f_string/c/string/mapss.c | 12 +- level_0/f_string/c/string/quantityss.c | 4 +- level_0/f_string/c/string/rangess.c | 4 +- level_0/f_string/c/string/triples.c | 24 +- level_0/f_string/c/string/tripless.c | 16 +- level_0/f_thread/c/thread/attribute.c | 4 +- level_0/f_thread/c/thread/barrier.c | 4 +- level_0/f_thread/c/thread/barrier_attribute.c | 4 +- level_0/f_thread/c/thread/condition.c | 4 +- level_0/f_thread/c/thread/condition_attribute.c | 4 +- level_0/f_thread/c/thread/key.c | 4 +- level_0/f_thread/c/thread/lock.c | 4 +- level_0/f_thread/c/thread/lock_attribute.c | 4 +- level_0/f_thread/c/thread/mutex.c | 4 +- level_0/f_thread/c/thread/mutex_attribute.c | 4 +- level_0/f_thread/c/thread/semaphore.c | 4 +- level_0/f_thread/c/thread/set.c | 4 +- level_0/f_thread/c/thread/spin.c | 4 +- level_0/f_type_array/c/type_array/cell.c | 4 +- level_0/f_type_array/c/type_array/file.c | 4 +- level_0/f_type_array/c/type_array/fll_id.c | 4 +- level_0/f_type_array/c/type_array/int128.c | 4 +- level_0/f_type_array/c/type_array/int16.c | 4 +- level_0/f_type_array/c/type_array/int32.c | 4 +- level_0/f_type_array/c/type_array/int8.c | 4 +- .../f_type_array/c/type_array/number_unsigned.c | 4 +- level_0/f_type_array/c/type_array/poll.c | 4 +- level_0/f_type_array/c/type_array/state.c | 4 +- level_0/f_type_array/c/type_array/status.c | 4 +- level_0/f_type_array/c/type_array/uint16.c | 4 +- level_0/f_type_array/c/type_array/uint32.c | 4 +- level_0/f_type_array/c/type_array/uint64.c | 4 +- level_0/f_utf/c/utf/dynamics.c | 4 +- level_0/f_utf/c/utf/dynamicss.c | 20 +- level_0/f_utf/c/utf/map_multis.c | 20 +- level_0/f_utf/c/utf/map_multiss.c | 24 +- level_0/f_utf/c/utf/maps.c | 8 +- level_0/f_utf/c/utf/mapss.c | 12 +- level_0/f_utf/c/utf/triples.c | 12 +- level_0/f_utf/c/utf/tripless.c | 16 +- 61 files changed, 1275 insertions(+), 752 deletions(-) diff --git a/level_0/f_account/c/account/accounts.c b/level_0/f_account/c/account/accounts.c index 00c41f3..1d03cbd 100644 --- a/level_0/f_account/c/account/accounts.c +++ b/level_0/f_account/c/account/accounts.c @@ -12,20 +12,32 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->home.string, &account->home.used, &account->home.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; + + if (account->home.size && account->home.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->home.string, &account->home.used, &account->home.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->label.string, &account->label.used, &account->label.size); - if (F_status_is_error(status)) return status; + if (account->label.size && account->label.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->label.string, &account->label.used, &account->label.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->name.string, &account->name.used, &account->name.size); - if (F_status_is_error(status)) return status; + if (account->name.size && account->name.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->name.string, &account->name.used, &account->name.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->password.string, &account->password.used, &account->password.size); - if (F_status_is_error(status)) return status; + if (account->password.size && account->password.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->password.string, &account->password.used, &account->password.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->shell.string, &account->shell.used, &account->shell.size); - if (F_status_is_error(status)) return status; + if (account->shell.size && account->shell.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &account->shell.string, &account->shell.used, &account->shell.size); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -39,20 +51,32 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->home.string, &account->home.used, &account->home.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->label.string, &account->label.used, &account->label.size); - if (F_status_is_error(status)) return status; + if (account->home.size && account->home.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->home.string, &account->home.used, &account->home.size); + if (F_status_is_error(status)) return status; + } + + if (account->label.size && account->label.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->label.string, &account->label.used, &account->label.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->name.string, &account->name.used, &account->name.size); - if (F_status_is_error(status)) return status; + if (account->name.size && account->name.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->name.string, &account->name.used, &account->name.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->password.string, &account->password.used, &account->password.size); - if (F_status_is_error(status)) return status; + if (account->password.size && account->password.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->password.string, &account->password.used, &account->password.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->shell.string, &account->shell.used, &account->shell.size); - if (F_status_is_error(status)) return status; + if (account->shell.size && account->shell.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &account->shell.string, &account->shell.used, &account->shell.size); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -68,20 +92,30 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].home.string, &array[i].home.used, &array[i].home.size); - if (F_status_is_error(status)) return status; + if (array[i].home.size && array[i].home.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].home.string, &array[i].home.used, &array[i].home.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].label.string, &array[i].label.used, &array[i].label.size); - if (F_status_is_error(status)) return status; + if (array[i].label.size && array[i].label.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].label.string, &array[i].label.used, &array[i].label.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); - if (F_status_is_error(status)) return status; + if (array[i].name.size && array[i].name.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].password.string, &array[i].password.used, &array[i].password.size); - if (F_status_is_error(status)) return status; + if (array[i].password.size && array[i].password.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].password.string, &array[i].password.used, &array[i].password.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].shell.string, &array[i].shell.used, &array[i].shell.size); - if (F_status_is_error(status)) return status; + if (array[i].shell.size && array[i].shell.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].shell.string, &array[i].shell.used, &array[i].shell.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -98,20 +132,30 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].home.string, &array[i].home.used, &array[i].home.size); - if (F_status_is_error(status)) return status; + if (array[i].home.size && array[i].home.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].home.string, &array[i].home.used, &array[i].home.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].label.string, &array[i].label.used, &array[i].label.size); - if (F_status_is_error(status)) return status; + if (array[i].label.size && array[i].label.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].label.string, &array[i].label.used, &array[i].label.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); - if (F_status_is_error(status)) return status; + if (array[i].name.size && array[i].name.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].password.string, &array[i].password.used, &array[i].password.size); - if (F_status_is_error(status)) return status; + if (array[i].password.size && array[i].password.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].password.string, &array[i].password.used, &array[i].password.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].shell.string, &array[i].shell.used, &array[i].shell.size); - if (F_status_is_error(status)) return status; + if (array[i].shell.size && array[i].shell.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].shell.string, &array[i].shell.used, &array[i].shell.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -131,23 +175,33 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].home.string, &array[i].array[j].home.used, &array[i].array[j].home.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].label.string, &array[i].array[j].label.used, &array[i].array[j].label.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].password.string, &array[i].array[j].password.used, &array[i].array[j].password.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].shell.string, &array[i].array[j].shell.used, &array[i].array[j].shell.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].home.size && array[i].array[j].home.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].home.string, &array[i].array[j].home.used, &array[i].array[j].home.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].label.size && array[i].array[j].label.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].label.string, &array[i].array[j].label.used, &array[i].array[j].label.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].name.size && array[i].array[j].name.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].password.size && array[i].array[j].password.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].password.string, &array[i].array[j].password.used, &array[i].array[j].password.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].shell.size && array[i].array[j].shell.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].shell.string, &array[i].array[j].shell.used, &array[i].array[j].shell.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_account_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -170,23 +224,33 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].home.string, &array[i].array[j].home.used, &array[i].array[j].home.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].label.string, &array[i].array[j].label.used, &array[i].array[j].label.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].password.string, &array[i].array[j].password.used, &array[i].array[j].password.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].shell.string, &array[i].array[j].shell.used, &array[i].array[j].shell.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].home.size && array[i].array[j].home.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].home.string, &array[i].array[j].home.used, &array[i].array[j].home.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].label.size && array[i].array[j].label.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].label.string, &array[i].array[j].label.used, &array[i].array[j].label.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].name.size && array[i].array[j].name.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].password.size && array[i].array[j].password.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].password.string, &array[i].array[j].password.used, &array[i].array[j].password.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].shell.size && array[i].array[j].shell.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].shell.string, &array[i].array[j].shell.used, &array[i].array[j].shell.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_account_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_directory/c/directory/listing.c b/level_0/f_directory/c/directory/listing.c index 71f78f8..94b7985 100644 --- a/level_0/f_directory/c/directory/listing.c +++ b/level_0/f_directory/c/directory/listing.c @@ -11,29 +11,47 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->block.array, &listing->block.used, &listing->block.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->character.array, &listing->character.used, &listing->character.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (listing->block.size && listing->block.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->block.array, &listing->block.used, &listing->block.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->directory.array, &listing->directory.used, &listing->directory.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (listing->character.size && listing->character.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->character.array, &listing->character.used, &listing->character.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->regular.array, &listing->regular.used, &listing->regular.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (listing->directory.size && listing->directory.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->directory.array, &listing->directory.used, &listing->directory.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->link.array, &listing->link.used, &listing->link.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (listing->regular.size && listing->regular.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->regular.array, &listing->regular.used, &listing->regular.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->fifo.array, &listing->fifo.used, &listing->fifo.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (listing->link.size && listing->link.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->link.array, &listing->link.used, &listing->link.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->socket.array, &listing->socket.used, &listing->socket.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (listing->fifo.size && listing->fifo.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->fifo.array, &listing->fifo.used, &listing->fifo.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->unknown.array, &listing->unknown.used, &listing->unknown.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (listing->socket.size && listing->socket.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->socket.array, &listing->socket.used, &listing->socket.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (listing->unknown.size && listing->unknown.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &listing->unknown.array, &listing->unknown.used, &listing->unknown.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -47,29 +65,47 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->block.array, &listing->block.used, &listing->block.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->character.array, &listing->character.used, &listing->character.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (listing->block.size && listing->block.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->block.array, &listing->block.used, &listing->block.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->directory.array, &listing->directory.used, &listing->directory.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (listing->character.size && listing->character.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->character.array, &listing->character.used, &listing->character.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->regular.array, &listing->regular.used, &listing->regular.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (listing->directory.size && listing->directory.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->directory.array, &listing->directory.used, &listing->directory.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (listing->regular.size && listing->regular.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->regular.array, &listing->regular.used, &listing->regular.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->link.array, &listing->link.used, &listing->link.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (listing->link.size && listing->link.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->link.array, &listing->link.used, &listing->link.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->fifo.array, &listing->fifo.used, &listing->fifo.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (listing->fifo.size && listing->fifo.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->fifo.array, &listing->fifo.used, &listing->fifo.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->socket.array, &listing->socket.used, &listing->socket.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (listing->socket.size && listing->socket.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->socket.array, &listing->socket.used, &listing->socket.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->unknown.array, &listing->unknown.used, &listing->unknown.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (listing->unknown.size && listing->unknown.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &listing->unknown.array, &listing->unknown.used, &listing->unknown.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -85,29 +121,45 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].block.array, &array[i].block.used, &array[i].block.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].block.size && array[i].block.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].block.array, &array[i].block.used, &array[i].block.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].character.array, &array[i].character.used, &array[i].character.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].character.size && array[i].character.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].character.array, &array[i].character.used, &array[i].character.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].directory.array, &array[i].directory.used, &array[i].directory.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].directory.size && array[i].directory.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].directory.array, &array[i].directory.used, &array[i].directory.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].regular.array, &array[i].regular.used, &array[i].regular.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].regular.size && array[i].regular.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].regular.array, &array[i].regular.used, &array[i].regular.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].link.array, &array[i].link.used, &array[i].link.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].link.size && array[i].link.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].link.array, &array[i].link.used, &array[i].link.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].fifo.array, &array[i].fifo.used, &array[i].fifo.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].fifo.size && array[i].fifo.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].fifo.array, &array[i].fifo.used, &array[i].fifo.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].socket.array, &array[i].socket.used, &array[i].socket.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].socket.size && array[i].socket.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].socket.array, &array[i].socket.used, &array[i].socket.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].unknown.array, &array[i].unknown.used, &array[i].unknown.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].unknown.size && array[i].unknown.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].unknown.array, &array[i].unknown.used, &array[i].unknown.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -124,29 +176,45 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].block.array, &array[i].block.used, &array[i].block.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].block.size && array[i].block.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].block.array, &array[i].block.used, &array[i].block.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].character.array, &array[i].character.used, &array[i].character.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].character.size && array[i].character.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].character.array, &array[i].character.used, &array[i].character.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].directory.array, &array[i].directory.used, &array[i].directory.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].directory.size && array[i].directory.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].directory.array, &array[i].directory.used, &array[i].directory.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].regular.array, &array[i].regular.used, &array[i].regular.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].regular.size && array[i].regular.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].regular.array, &array[i].regular.used, &array[i].regular.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].link.array, &array[i].link.used, &array[i].link.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].link.size && array[i].link.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].link.array, &array[i].link.used, &array[i].link.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].fifo.array, &array[i].fifo.used, &array[i].fifo.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].fifo.size && array[i].fifo.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].fifo.array, &array[i].fifo.used, &array[i].fifo.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].socket.array, &array[i].socket.used, &array[i].socket.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].socket.size && array[i].socket.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].socket.array, &array[i].socket.used, &array[i].socket.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].unknown.array, &array[i].unknown.used, &array[i].unknown.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].unknown.size && array[i].unknown.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].unknown.array, &array[i].unknown.used, &array[i].unknown.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -166,32 +234,48 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].block.array, &array[i].array[j].block.used, &array[i].array[j].block.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].character.array, &array[i].array[j].character.used, &array[i].array[j].character.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].directory.array, &array[i].array[j].directory.used, &array[i].array[j].directory.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].regular.array, &array[i].array[j].regular.used, &array[i].array[j].regular.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].link.array, &array[i].array[j].link.used, &array[i].array[j].link.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].fifo.array, &array[i].array[j].fifo.used, &array[i].array[j].fifo.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].socket.array, &array[i].array[j].socket.used, &array[i].array[j].socket.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].unknown.array, &array[i].array[j].unknown.used, &array[i].array[j].unknown.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].block.size && array[i].array[j].block.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].block.array, &array[i].array[j].block.used, &array[i].array[j].block.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].character.size && array[i].array[j].character.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].character.array, &array[i].array[j].character.used, &array[i].array[j].character.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].directory.size && array[i].array[j].directory.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].directory.array, &array[i].array[j].directory.used, &array[i].array[j].directory.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].regular.size && array[i].array[j].regular.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].regular.array, &array[i].array[j].regular.used, &array[i].array[j].regular.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].link.size && array[i].array[j].link.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].link.array, &array[i].array[j].link.used, &array[i].array[j].link.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].fifo.size && array[i].array[j].fifo.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].fifo.array, &array[i].array[j].fifo.used, &array[i].array[j].fifo.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].socket.size && array[i].array[j].socket.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].socket.array, &array[i].array[j].socket.used, &array[i].array[j].socket.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].unknown.size && array[i].array[j].unknown.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].unknown.array, &array[i].array[j].unknown.used, &array[i].array[j].unknown.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_directory_listing_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -214,32 +298,48 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].block.array, &array[i].array[j].block.used, &array[i].array[j].block.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].character.array, &array[i].array[j].character.used, &array[i].array[j].character.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].directory.array, &array[i].array[j].directory.used, &array[i].array[j].directory.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].regular.array, &array[i].array[j].regular.used, &array[i].array[j].regular.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].link.array, &array[i].array[j].link.used, &array[i].array[j].link.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].fifo.array, &array[i].array[j].fifo.used, &array[i].array[j].fifo.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].socket.array, &array[i].array[j].socket.used, &array[i].array[j].socket.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].unknown.array, &array[i].array[j].unknown.used, &array[i].array[j].unknown.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].block.size && array[i].array[j].block.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].block.array, &array[i].array[j].block.used, &array[i].array[j].block.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].character.size && array[i].array[j].character.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].character.array, &array[i].array[j].character.used, &array[i].array[j].character.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].directory.size && array[i].array[j].directory.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].directory.array, &array[i].array[j].directory.used, &array[i].array[j].directory.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].regular.size && array[i].array[j].regular.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].regular.array, &array[i].array[j].regular.used, &array[i].array[j].regular.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].link.size && array[i].array[j].link.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].link.array, &array[i].array[j].link.used, &array[i].array[j].link.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].fifo.size && array[i].array[j].fifo.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].fifo.array, &array[i].array[j].fifo.used, &array[i].array[j].fifo.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].socket.size && array[i].array[j].socket.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].socket.array, &array[i].array[j].socket.used, &array[i].array[j].socket.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].unknown.size && array[i].array[j].unknown.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].unknown.array, &array[i].array[j].unknown.used, &array[i].array[j].unknown.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_directory_listing_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_directory/c/directory/recurse_do.c b/level_0/f_directory/c/directory/recurse_do.c index a236e51..8222493 100644 --- a/level_0/f_directory/c/directory/recurse_do.c +++ b/level_0/f_directory/c/directory/recurse_do.c @@ -11,35 +11,57 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &recurse->path.string, &recurse->path.used, &recurse->path.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; + + if (recurse->path.size && recurse->path.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &recurse->path.string, &recurse->path.used, &recurse->path.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &recurse->path_cache.string, &recurse->path_cache.used, &recurse->path_cache.size); - if (F_status_is_error(status)) return status; + if (recurse->path_cache.size && recurse->path_cache.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &recurse->path_cache.string, &recurse->path_cache.used, &recurse->path_cache.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.block.array, &recurse->listing.block.used, &recurse->listing.block.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.block.size && recurse->listing.block.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.block.array, &recurse->listing.block.used, &recurse->listing.block.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.character.array, &recurse->listing.character.used, &recurse->listing.character.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.character.size && recurse->listing.character.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.character.array, &recurse->listing.character.used, &recurse->listing.character.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.directory.array, &recurse->listing.directory.used, &recurse->listing.directory.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.directory.size && recurse->listing.directory.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.directory.array, &recurse->listing.directory.used, &recurse->listing.directory.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.regular.array, &recurse->listing.regular.used, &recurse->listing.regular.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.regular.size && recurse->listing.regular.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.regular.array, &recurse->listing.regular.used, &recurse->listing.regular.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.link.array, &recurse->listing.link.used, &recurse->listing.link.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.link.size && recurse->listing.link.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.link.array, &recurse->listing.link.used, &recurse->listing.link.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.fifo.array, &recurse->listing.fifo.used, &recurse->listing.fifo.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.fifo.size && recurse->listing.fifo.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.fifo.array, &recurse->listing.fifo.used, &recurse->listing.fifo.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.socket.array, &recurse->listing.socket.used, &recurse->listing.socket.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.socket.size && recurse->listing.socket.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.socket.array, &recurse->listing.socket.used, &recurse->listing.socket.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.unknown.array, &recurse->listing.unknown.used, &recurse->listing.unknown.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.unknown.size && recurse->listing.unknown.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.unknown.array, &recurse->listing.unknown.used, &recurse->listing.unknown.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -53,35 +75,57 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &recurse->path.string, &recurse->path.used, &recurse->path.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &recurse->path_cache.string, &recurse->path_cache.used, &recurse->path_cache.size); - if (F_status_is_error(status)) return status; + if (recurse->path.size && recurse->path.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &recurse->path.string, &recurse->path.used, &recurse->path.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.block.array, &recurse->listing.block.used, &recurse->listing.block.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (recurse->path_cache.size && recurse->path_cache.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &recurse->path_cache.string, &recurse->path_cache.used, &recurse->path_cache.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.character.array, &recurse->listing.character.used, &recurse->listing.character.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.block.size && recurse->listing.block.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.block.array, &recurse->listing.block.used, &recurse->listing.block.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.directory.array, &recurse->listing.directory.used, &recurse->listing.directory.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.character.size && recurse->listing.character.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.character.array, &recurse->listing.character.used, &recurse->listing.character.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (recurse->listing.directory.size && recurse->listing.directory.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.directory.array, &recurse->listing.directory.used, &recurse->listing.directory.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.regular.array, &recurse->listing.regular.used, &recurse->listing.regular.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.regular.size && recurse->listing.regular.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.regular.array, &recurse->listing.regular.used, &recurse->listing.regular.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.link.array, &recurse->listing.link.used, &recurse->listing.link.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.link.size && recurse->listing.link.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.link.array, &recurse->listing.link.used, &recurse->listing.link.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.fifo.array, &recurse->listing.fifo.used, &recurse->listing.fifo.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.fifo.size && recurse->listing.fifo.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.fifo.array, &recurse->listing.fifo.used, &recurse->listing.fifo.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.socket.array, &recurse->listing.socket.used, &recurse->listing.socket.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.socket.size && recurse->listing.socket.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.socket.array, &recurse->listing.socket.used, &recurse->listing.socket.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.unknown.array, &recurse->listing.unknown.used, &recurse->listing.unknown.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (recurse->listing.unknown.size && recurse->listing.unknown.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &recurse->listing.unknown.array, &recurse->listing.unknown.used, &recurse->listing.unknown.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -97,35 +141,55 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].path.string, &array[i].path.used, &array[i].path.size); - if (F_status_is_error(status)) return status; + if (array[i].path.size && array[i].path.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].path.string, &array[i].path.used, &array[i].path.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].path_cache.string, &array[i].path_cache.used, &array[i].path_cache.size); - if (F_status_is_error(status)) return status; + if (array[i].path_cache.size && array[i].path_cache.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].path_cache.string, &array[i].path_cache.used, &array[i].path_cache.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.block.array, &array[i].listing.block.used, &array[i].listing.block.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.block.size && array[i].listing.block.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.block.array, &array[i].listing.block.used, &array[i].listing.block.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.character.array, &array[i].listing.character.used, &array[i].listing.character.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.character.size && array[i].listing.character.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.character.array, &array[i].listing.character.used, &array[i].listing.character.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.directory.array, &array[i].listing.directory.used, &array[i].listing.directory.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.directory.size && array[i].listing.directory.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.directory.array, &array[i].listing.directory.used, &array[i].listing.directory.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.regular.array, &array[i].listing.regular.used, &array[i].listing.regular.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.regular.size && array[i].listing.regular.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.regular.array, &array[i].listing.regular.used, &array[i].listing.regular.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.link.array, &array[i].listing.link.used, &array[i].listing.link.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.link.size && array[i].listing.link.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.link.array, &array[i].listing.link.used, &array[i].listing.link.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.fifo.array, &array[i].listing.fifo.used, &array[i].listing.fifo.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.fifo.size && array[i].listing.fifo.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.fifo.array, &array[i].listing.fifo.used, &array[i].listing.fifo.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.socket.array, &array[i].listing.socket.used, &array[i].listing.socket.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.socket.size && array[i].listing.socket.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.socket.array, &array[i].listing.socket.used, &array[i].listing.socket.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.unknown.array, &array[i].listing.unknown.used, &array[i].listing.unknown.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.unknown.size && array[i].listing.unknown.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.unknown.array, &array[i].listing.unknown.used, &array[i].listing.unknown.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -142,35 +206,55 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].path.string, &array[i].path.used, &array[i].path.size); - if (F_status_is_error(status)) return status; + if (array[i].path.size && array[i].path.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].path.string, &array[i].path.used, &array[i].path.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].path_cache.string, &array[i].path_cache.used, &array[i].path_cache.size); - if (F_status_is_error(status)) return status; + if (array[i].path_cache.size && array[i].path_cache.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].path_cache.string, &array[i].path_cache.used, &array[i].path_cache.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.block.array, &array[i].listing.block.used, &array[i].listing.block.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.block.size && array[i].listing.block.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.block.array, &array[i].listing.block.used, &array[i].listing.block.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.character.array, &array[i].listing.character.used, &array[i].listing.character.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.character.size && array[i].listing.character.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.character.array, &array[i].listing.character.used, &array[i].listing.character.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.directory.array, &array[i].listing.directory.used, &array[i].listing.directory.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.directory.size && array[i].listing.directory.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.directory.array, &array[i].listing.directory.used, &array[i].listing.directory.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.regular.array, &array[i].listing.regular.used, &array[i].listing.regular.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.regular.size && array[i].listing.regular.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.regular.array, &array[i].listing.regular.used, &array[i].listing.regular.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.link.array, &array[i].listing.link.used, &array[i].listing.link.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.link.size && array[i].listing.link.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.link.array, &array[i].listing.link.used, &array[i].listing.link.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.fifo.array, &array[i].listing.fifo.used, &array[i].listing.fifo.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.fifo.size && array[i].listing.fifo.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.fifo.array, &array[i].listing.fifo.used, &array[i].listing.fifo.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.socket.array, &array[i].listing.socket.used, &array[i].listing.socket.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.socket.size && array[i].listing.socket.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.socket.array, &array[i].listing.socket.used, &array[i].listing.socket.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.unknown.array, &array[i].listing.unknown.used, &array[i].listing.unknown.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].listing.unknown.size && array[i].listing.unknown.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].listing.unknown.array, &array[i].listing.unknown.used, &array[i].listing.unknown.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -190,38 +274,58 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].path.string, &array[i].array[j].path.used, &array[i].array[j].path.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].path_cache.string, &array[i].array[j].path_cache.used, &array[i].array[j].path_cache.size); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.block.array, &array[i].array[j].listing.block.used, &array[i].array[j].listing.block.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.character.array, &array[i].array[j].listing.character.used, &array[i].array[j].listing.character.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.directory.array, &array[i].array[j].listing.directory.used, &array[i].array[j].listing.directory.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.regular.array, &array[i].array[j].listing.regular.used, &array[i].array[j].listing.regular.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.link.array, &array[i].array[j].listing.link.used, &array[i].array[j].listing.link.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.fifo.array, &array[i].array[j].listing.fifo.used, &array[i].array[j].listing.fifo.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.socket.array, &array[i].array[j].listing.socket.used, &array[i].array[j].listing.socket.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.unknown.array, &array[i].array[j].listing.unknown.used, &array[i].array[j].listing.unknown.size, &f_string_dynamics_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].path.size && array[i].array[j].path.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].path.string, &array[i].array[j].path.used, &array[i].array[j].path.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].path_cache.size && array[i].array[j].path_cache.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].path_cache.string, &array[i].array[j].path_cache.used, &array[i].array[j].path_cache.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.block.size && array[i].array[j].listing.block.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.block.array, &array[i].array[j].listing.block.used, &array[i].array[j].listing.block.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.character.size && array[i].array[j].listing.character.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.character.array, &array[i].array[j].listing.character.used, &array[i].array[j].listing.character.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.directory.size && array[i].array[j].listing.directory.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.directory.array, &array[i].array[j].listing.directory.used, &array[i].array[j].listing.directory.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.regular.size && array[i].array[j].listing.regular.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.regular.array, &array[i].array[j].listing.regular.used, &array[i].array[j].listing.regular.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.link.size && array[i].array[j].listing.link.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.link.array, &array[i].array[j].listing.link.used, &array[i].array[j].listing.link.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.fifo.size && array[i].array[j].listing.fifo.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.fifo.array, &array[i].array[j].listing.fifo.used, &array[i].array[j].listing.fifo.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.socket.size && array[i].array[j].listing.socket.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.socket.array, &array[i].array[j].listing.socket.used, &array[i].array[j].listing.socket.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.unknown.size && array[i].array[j].listing.unknown.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.unknown.array, &array[i].array[j].listing.unknown.used, &array[i].array[j].listing.unknown.size, &f_string_dynamics_delete_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_directory_recurse_do_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -244,38 +348,58 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].path.string, &array[i].array[j].path.used, &array[i].array[j].path.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].path_cache.string, &array[i].array[j].path_cache.used, &array[i].array[j].path_cache.size); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.block.array, &array[i].array[j].listing.block.used, &array[i].array[j].listing.block.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.character.array, &array[i].array[j].listing.character.used, &array[i].array[j].listing.character.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.directory.array, &array[i].array[j].listing.directory.used, &array[i].array[j].listing.directory.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.regular.array, &array[i].array[j].listing.regular.used, &array[i].array[j].listing.regular.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.link.array, &array[i].array[j].listing.link.used, &array[i].array[j].listing.link.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.fifo.array, &array[i].array[j].listing.fifo.used, &array[i].array[j].listing.fifo.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.socket.array, &array[i].array[j].listing.socket.used, &array[i].array[j].listing.socket.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.unknown.array, &array[i].array[j].listing.unknown.used, &array[i].array[j].listing.unknown.size, &f_string_dynamics_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].path.size && array[i].array[j].path.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].path.string, &array[i].array[j].path.used, &array[i].array[j].path.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].path_cache.size && array[i].array[j].path_cache.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].path_cache.string, &array[i].array[j].path_cache.used, &array[i].array[j].path_cache.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.block.size && array[i].array[j].listing.block.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.block.array, &array[i].array[j].listing.block.used, &array[i].array[j].listing.block.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.character.size && array[i].array[j].listing.character.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.character.array, &array[i].array[j].listing.character.used, &array[i].array[j].listing.character.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.directory.size && array[i].array[j].listing.directory.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.directory.array, &array[i].array[j].listing.directory.used, &array[i].array[j].listing.directory.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.regular.size && array[i].array[j].listing.regular.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.regular.array, &array[i].array[j].listing.regular.used, &array[i].array[j].listing.regular.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.link.size && array[i].array[j].listing.link.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.link.array, &array[i].array[j].listing.link.used, &array[i].array[j].listing.link.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.fifo.size && array[i].array[j].listing.fifo.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.fifo.array, &array[i].array[j].listing.fifo.used, &array[i].array[j].listing.fifo.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.socket.size && array[i].array[j].listing.socket.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.socket.array, &array[i].array[j].listing.socket.used, &array[i].array[j].listing.socket.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].listing.unknown.size && array[i].array[j].listing.unknown.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].listing.unknown.array, &array[i].array[j].listing.unknown.used, &array[i].array[j].listing.unknown.size, &f_string_dynamics_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_directory_recurse_do_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_directory/c/directory/status.c b/level_0/f_directory/c/directory/status.c index 3138de3..cc0a03b 100644 --- a/level_0/f_directory/c/directory/status.c +++ b/level_0/f_directory/c/directory/status.c @@ -43,8 +43,10 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].path.string, &array[i].path.used, &array[i].path.size); - if (F_status_is_error(status)) return status; + if (array[i].path.size && array[i].path.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].path.string, &array[i].path.used, &array[i].path.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -61,8 +63,10 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].path.string, &array[i].path.used, &array[i].path.size); - if (F_status_is_error(status)) return status; + if (array[i].path.size && array[i].path.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].path.string, &array[i].path.used, &array[i].path.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -82,11 +86,13 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].path.string, &array[i].array[j].path.used, &array[i].array[j].path.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].path.size && array[i].array[j].path.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].path.string, &array[i].array[j].path.used, &array[i].array[j].path.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_directory_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -109,11 +115,13 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].path.string, &array[i].array[j].path.used, &array[i].array[j].path.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].path.size && array[i].array[j].path.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].path.string, &array[i].array[j].path.used, &array[i].array[j].path.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_directory_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_fss/c/fss/item.c b/level_0/f_fss/c/fss/item.c index a0f1149..9512981 100644 --- a/level_0/f_fss/c/fss/item.c +++ b/level_0/f_fss/c/fss/item.c @@ -33,8 +33,10 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].content.array, &array[i].content.used, &array[i].content.size); - if (F_status_is_error(status)) return status; + if (array[i].content.size && array[i].content.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].content.array, &array[i].content.used, &array[i].content.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -51,8 +53,10 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].content.array, &array[i].content.used, &array[i].content.size); - if (F_status_is_error(status)) return status; + if (array[i].content.size && array[i].content.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].content.array, &array[i].content.used, &array[i].content.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -72,11 +76,13 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].content.array, &array[i].array[j].content.used, &array[i].array[j].content.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].content.size && array[i].array[j].content.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].content.array, &array[i].array[j].content.used, &array[i].array[j].content.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_fss_item_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -99,11 +105,13 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].content.array, &array[i].array[j].content.used, &array[i].array[j].content.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].content.size && array[i].array[j].content.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].content.array, &array[i].array[j].content.used, &array[i].array[j].content.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_fss_item_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_fss/c/fss/named.c b/level_0/f_fss/c/fss/named.c index 57801bc..b08c5d2 100644 --- a/level_0/f_fss/c/fss/named.c +++ b/level_0/f_fss/c/fss/named.c @@ -11,14 +11,22 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &named->objects.array, &named->objects.used, &named->objects.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &named->contents.array, &named->contents.used, &named->contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; + if (named->objects.size && named->objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &named->objects.array, &named->objects.used, &named->objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8ss_delete_callback); - if (F_status_is_error(status)) return status; + if (named->contents.size && named->contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &named->contents.array, &named->contents.used, &named->contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (named->quotess.size && named->quotess.array) { + status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -32,14 +40,22 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &named->objects.array, &named->objects.used, &named->objects.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; + + if (named->objects.size && named->objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &named->objects.array, &named->objects.used, &named->objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &named->contents.array, &named->contents.used, &named->contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; + if (named->contents.size && named->contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &named->contents.array, &named->contents.used, &named->contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8ss_destroy_callback); - if (F_status_is_error(status)) return status; + if (named->quotess.size && named->quotess.array) { + status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &named->quotess.array, &named->quotess.used, &named->quotess.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -55,14 +71,20 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].objects.size && array[i].objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].contents.size && array[i].contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &array[i].quotess.array, &array[i].quotess.used, &array[i].quotess.size, &f_uint8ss_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].quotess.size && array[i].quotess.array) { + status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &array[i].quotess.array, &array[i].quotess.used, &array[i].quotess.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -79,14 +101,20 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].objects.size && array[i].objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].contents.size && array[i].contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &array[i].quotess.array, &array[i].quotess.used, &array[i].quotess.size, &f_uint8ss_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].quotess.size && array[i].quotess.array) { + status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &array[i].quotess.array, &array[i].quotess.used, &array[i].quotess.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -106,17 +134,23 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].objects.size && array[i].array[j].objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].contents.size && array[i].array[j].contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &array[i].array[j].quotess.array, &array[i].array[j].quotess.used, &array[i].array[j].quotess.size, &f_uint8ss_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].quotess.size && array[i].array[j].quotess.array) { + status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &array[i].array[j].quotess.array, &array[i].array[j].quotess.used, &array[i].array[j].quotess.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_fss_named_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -139,17 +173,23 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].objects.size && array[i].array[j].objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].contents.size && array[i].array[j].contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &array[i].array[j].quotess.array, &array[i].array[j].quotess.used, &array[i].array[j].quotess.size, &f_uint8ss_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].quotess.size && array[i].array[j].quotess.array) { + status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &array[i].array[j].quotess.array, &array[i].array[j].quotess.used, &array[i].array[j].quotess.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_fss_named_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_fss/c/fss/nest.c b/level_0/f_fss/c/fss/nest.c index c0acd1d..376a411 100644 --- a/level_0/f_fss/c/fss/nest.c +++ b/level_0/f_fss/c/fss/nest.c @@ -18,18 +18,24 @@ extern "C" { for (j = 0; j < nest->depth[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &nest->depth[i].array[j].content.array, &nest->depth[i].array[j].content.used, &nest->depth[i].array[j].content.size); - if (F_status_is_error(status)) return status; + if (nest->depth[i].array[j].content.size && nest->depth[i].array[j].content.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &nest->depth[i].array[j].content.array, &nest->depth[i].array[j].content.used, &nest->depth[i].array[j].content.size); + if (F_status_is_error(status)) return status; + } } // for - if (nest->depth[i].size) { + if (nest->depth[i].size && nest->depth[i].array) { status = f_memory_array_resize(0, sizeof(f_fss_item_t), (void **) &nest->depth[i].array, &nest->depth[i].used, &nest->depth[i].size); if (F_status_is_error(status)) return status; } } // for } - return f_memory_array_resize(0, sizeof(f_fss_items_t), (void **) &nest->depth, &nest->used, &nest->size); + if (nest->size && nest->depth) { + return f_memory_array_resize(0, sizeof(f_fss_items_t), (void **) &nest->depth, &nest->used, &nest->size); + } + + return F_okay; } #endif // _di_f_fss_nest_delete_ @@ -47,18 +53,24 @@ extern "C" { for (j = 0; j < nest->depth[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &nest->depth[i].array[j].content.array, &nest->depth[i].array[j].content.used, &nest->depth[i].array[j].content.size); - if (F_status_is_error(status)) return status; + if (nest->depth[i].array[j].content.size && nest->depth[i].array[j].content.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &nest->depth[i].array[j].content.array, &nest->depth[i].array[j].content.used, &nest->depth[i].array[j].content.size); + if (F_status_is_error(status)) return status; + } } // for - if (nest->depth[i].size) { + if (nest->depth[i].size && nest->depth[i].array) { status = f_memory_array_adjust(0, sizeof(f_fss_item_t), (void **) &nest->depth[i].array, &nest->depth[i].used, &nest->depth[i].size); if (F_status_is_error(status)) return status; } } // for } - return f_memory_array_adjust(0, sizeof(f_fss_items_t), (void **) &nest->depth, &nest->used, &nest->size); + if (nest->size && nest->depth) { + return f_memory_array_adjust(0, sizeof(f_fss_items_t), (void **) &nest->depth, &nest->used, &nest->size); + } + + return F_okay; } #endif // _di_f_fss_nest_destroy_ @@ -77,17 +89,19 @@ extern "C" { for (k = 0; k < array[i].depth[j].size; ++k) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].depth[j].array[k].content.array, &array[i].depth[j].array[k].content.used, &array[i].depth[j].array[k].content.size); - if (F_status_is_error(status)) return status; + if (array[i].depth[j].array[k].content.size && array[i].depth[j].array[k].content.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].depth[j].array[k].content.array, &array[i].depth[j].array[k].content.used, &array[i].depth[j].array[k].content.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].depth[j].size) { + if (array[i].depth[j].size && array[i].depth[j].array) { status = f_memory_array_resize(0, sizeof(f_fss_item_t), (void **) &array[i].depth[j].array, &array[i].depth[j].used, &array[i].depth[j].size); if (F_status_is_error(status)) return status; } } // for - if (array[i].size) { + if (array[i].size && array[i].depth) { status = f_memory_array_resize(0, sizeof(f_fss_items_t), (void **) &array[i].depth, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -113,17 +127,19 @@ extern "C" { for (k = 0; k < array[i].depth[j].size; ++k) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].depth[j].array[k].content.array, &array[i].depth[j].array[k].content.used, &array[i].depth[j].array[k].content.size); - if (F_status_is_error(status)) return status; + if (array[i].depth[j].array[k].content.size && array[i].depth[j].array[k].content.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].depth[j].array[k].content.array, &array[i].depth[j].array[k].content.used, &array[i].depth[j].array[k].content.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].depth[j].size) { + if (array[i].depth[j].size && array[i].depth[j].array) { status = f_memory_array_adjust(0, sizeof(f_fss_item_t), (void **) &array[i].depth[j].array, &array[i].depth[j].used, &array[i].depth[j].size); if (F_status_is_error(status)) return status; } } // for - if (array[i].size) { + if (array[i].size && array[i].depth) { status = f_memory_array_adjust(0, sizeof(f_fss_items_t), (void **) &array[i].depth, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -152,23 +168,25 @@ extern "C" { for (l = 0; l < array[i].array[j].depth[k].size; ++l) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].depth[k].array[l].content.array, &array[i].array[j].depth[k].array[l].content.used, &array[i].array[j].depth[k].array[l].content.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].depth[k].array[l].content.size && array[i].array[j].depth[k].array[l].content.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].depth[k].array[l].content.array, &array[i].array[j].depth[k].array[l].content.used, &array[i].array[j].depth[k].array[l].content.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].array[j].depth[k].size) { + if (array[i].array[j].depth[k].size && array[i].array[j].depth[k].array) { status = f_memory_array_resize(0, sizeof(f_fss_item_t), (void **) &array[i].array[j].depth[k].array, &array[i].array[j].depth[k].used, &array[i].array[j].depth[k].size); if (F_status_is_error(status)) return status; } } // for - if (array[i].array[j].size) { + if (array[i].array[j].size && array[i].array[j].depth) { status = f_memory_array_resize(0, sizeof(f_fss_items_t), (void **) &array[i].array[j].depth, &array[i].array[j].used, &array[i].array[j].size); if (F_status_is_error(status)) return status; } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_fss_nest_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -197,23 +215,25 @@ extern "C" { for (l = 0; l < array[i].array[j].depth[k].size; ++l) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].depth[k].array[l].content.array, &array[i].array[j].depth[k].array[l].content.used, &array[i].array[j].depth[k].array[l].content.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].depth[k].array[l].content.size && array[i].array[j].depth[k].array[l].content.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].depth[k].array[l].content.array, &array[i].array[j].depth[k].array[l].content.used, &array[i].array[j].depth[k].array[l].content.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].array[j].depth[k].size) { + if (array[i].array[j].depth[k].size && array[i].array[j].depth[k].array) { status = f_memory_array_adjust(0, sizeof(f_fss_item_t), (void **) &array[i].array[j].depth[k].array, &array[i].array[j].depth[k].used, &array[i].array[j].depth[k].size); if (F_status_is_error(status)) return status; } } // for - if (array[i].array[j].size) { + if (array[i].array[j].size && array[i].array[j].depth) { status = f_memory_array_adjust(0, sizeof(f_fss_items_t), (void **) &array[i].array[j].depth, &array[i].array[j].used, &array[i].array[j].size); if (F_status_is_error(status)) return status; } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_fss_nest_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_fss/c/fss/set.c b/level_0/f_fss/c/fss/set.c index 7563c59..1b25f99 100644 --- a/level_0/f_fss/c/fss/set.c +++ b/level_0/f_fss/c/fss/set.c @@ -11,11 +11,17 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &set->objects.array, &set->objects.used, &set->objects.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; + + if (set->objects.size && set->objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &set->objects.array, &set->objects.used, &set->objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &set->contents.array, &set->contents.used, &set->contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; + if (set->contents.size && set->contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &set->contents.array, &set->contents.used, &set->contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -29,11 +35,17 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &set->objects.array, &set->objects.used, &set->objects.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; + + if (set->objects.size && set->objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &set->objects.array, &set->objects.used, &set->objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &set->contents.array, &set->contents.used, &set->contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; + if (set->contents.size && set->contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &set->contents.array, &set->contents.used, &set->contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -49,11 +61,15 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].objects.size && array[i].objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].contents.size && array[i].contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -70,11 +86,15 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].objects.size && array[i].objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].contents.size && array[i].contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -94,14 +114,18 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].objects.size && array[i].array[j].objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].contents.size && array[i].array[j].contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_fss_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -124,14 +148,18 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].objects.size && array[i].array[j].objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].contents.size && array[i].array[j].contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_fss_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_fss/c/fss/set_quote.c b/level_0/f_fss/c/fss/set_quote.c index 6a75cd6..4bf780f 100644 --- a/level_0/f_fss/c/fss/set_quote.c +++ b/level_0/f_fss/c/fss/set_quote.c @@ -11,17 +11,27 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &set_quote->objects.array, &set_quote->objects.used, &set_quote->objects.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &set_quote->contents.array, &set_quote->contents.used, &set_quote->contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; + if (set_quote->objects.size && set_quote->objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &set_quote->objects.array, &set_quote->objects.used, &set_quote->objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); - if (F_status_is_error(status)) return status; + if (set_quote->contents.size && set_quote->contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &set_quote->contents.array, &set_quote->contents.used, &set_quote->contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8ss_delete_callback); - if (F_status_is_error(status)) return status; + if (set_quote->objects_quote.size && set_quote->objects_quote.array) { + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); + if (F_status_is_error(status)) return status; + } + + if (set_quote->contents_quote.size && set_quote->contents_quote.array) { + status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -35,17 +45,27 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &set_quote->objects.array, &set_quote->objects.used, &set_quote->objects.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &set_quote->contents.array, &set_quote->contents.used, &set_quote->contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; + if (set_quote->objects.size && set_quote->objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &set_quote->objects.array, &set_quote->objects.used, &set_quote->objects.size); + if (F_status_is_error(status)) return status; + } + + if (set_quote->contents.size && set_quote->contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &set_quote->contents.array, &set_quote->contents.used, &set_quote->contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); - if (F_status_is_error(status)) return status; + if (set_quote->objects_quote.size && set_quote->objects_quote.array) { + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &set_quote->objects_quote.array, &set_quote->objects_quote.used, &set_quote->objects_quote.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8ss_destroy_callback); - if (F_status_is_error(status)) return status; + if (set_quote->contents_quote.size && set_quote->contents_quote.array) { + status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &set_quote->contents_quote.array, &set_quote->contents_quote.used, &set_quote->contents_quote.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -61,17 +81,25 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].objects.size && array[i].objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].contents.size && array[i].contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].objects_quote.array, &array[i].objects_quote.used, &array[i].objects_quote.size); - if (F_status_is_error(status)) return status; + if (array[i].objects_quote.size && array[i].objects_quote.array) { + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].objects_quote.array, &array[i].objects_quote.used, &array[i].objects_quote.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &array[i].contents_quote.array, &array[i].contents_quote.used, &array[i].contents_quote.size, &f_uint8ss_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].contents_quote.size && array[i].contents_quote.array) { + status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &array[i].contents_quote.array, &array[i].contents_quote.used, &array[i].contents_quote.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -88,17 +116,25 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); - if (F_status_is_error(status)) return status; + if (array[i].objects.size && array[i].objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].objects.array, &array[i].objects.used, &array[i].objects.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].contents.size && array[i].contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].contents.array, &array[i].contents.used, &array[i].contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].objects_quote.array, &array[i].objects_quote.used, &array[i].objects_quote.size); - if (F_status_is_error(status)) return status; + if (array[i].objects_quote.size && array[i].objects_quote.array) { + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].objects_quote.array, &array[i].objects_quote.used, &array[i].objects_quote.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &array[i].contents_quote.array, &array[i].contents_quote.used, &array[i].contents_quote.size, &f_uint8ss_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].contents_quote.size && array[i].contents_quote.array) { + status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &array[i].contents_quote.array, &array[i].contents_quote.used, &array[i].contents_quote.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for } @@ -118,20 +154,28 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_delete_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].array[j].objects_quote.array, &array[i].array[j].objects_quote.used, &array[i].array[j].objects_quote.size); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &array[i].array[j].contents_quote.array, &array[i].array[j].contents_quote.used, &array[i].array[j].contents_quote.size, &f_uint8ss_delete_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].objects.size && array[i].array[j].objects.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].contents.size && array[i].array[j].contents.array) { + status = f_memory_arrays_resize(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_delete_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].objects_quote.size && array[i].array[j].objects_quote.array) { + status = f_memory_array_resize(0, sizeof(uint8_t), (void **) &array[i].array[j].objects_quote.array, &array[i].array[j].objects_quote.used, &array[i].array[j].objects_quote.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].contents_quote.size && array[i].array[j].contents_quote.array) { + status = f_memory_arrays_resize(0, sizeof(f_uint8s_t), (void **) &array[i].array[j].contents_quote.array, &array[i].array[j].contents_quote.used, &array[i].array[j].contents_quote.size, &f_uint8ss_delete_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_fss_set_quote_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -154,20 +198,28 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_destroy_callback); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].array[j].objects_quote.array, &array[i].array[j].objects_quote.used, &array[i].array[j].objects_quote.size); - if (F_status_is_error(status)) return status; - - status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &array[i].array[j].contents_quote.array, &array[i].array[j].contents_quote.used, &array[i].array[j].contents_quote.size, &f_uint8ss_destroy_callback); - if (F_status_is_error(status)) return status; + if (array[i].array[j].objects.size && array[i].array[j].objects.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].objects.array, &array[i].array[j].objects.used, &array[i].array[j].objects.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].contents.size && array[i].array[j].contents.array) { + status = f_memory_arrays_adjust(0, sizeof(f_string_ranges_t), (void **) &array[i].array[j].contents.array, &array[i].array[j].contents.used, &array[i].array[j].contents.size, &f_string_rangess_destroy_callback); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].objects_quote.size && array[i].array[j].objects_quote.array) { + status = f_memory_array_adjust(0, sizeof(uint8_t), (void **) &array[i].array[j].objects_quote.array, &array[i].array[j].objects_quote.used, &array[i].array[j].objects_quote.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].contents_quote.size && array[i].array[j].contents_quote.array) { + status = f_memory_arrays_adjust(0, sizeof(f_uint8s_t), (void **) &array[i].array[j].contents_quote.array, &array[i].array[j].contents_quote.used, &array[i].array[j].contents_quote.size, &f_uint8ss_destroy_callback); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_fss_set_quote_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_fss/c/fss/simple_packet.c b/level_0/f_fss/c/fss/simple_packet.c index f76e60e..efb57a8 100644 --- a/level_0/f_fss/c/fss/simple_packet.c +++ b/level_0/f_fss/c/fss/simple_packet.c @@ -10,7 +10,7 @@ extern "C" { if (!simple_packet) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - { + if (simple_packet->payload.size && simple_packet->payload.string) { const f_status_t status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &simple_packet->payload.string, &simple_packet->payload.used, &simple_packet->payload.size); if (F_status_is_error(status)) return status; } @@ -25,7 +25,7 @@ extern "C" { if (!simple_packet) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - { + if (simple_packet->payload.size && simple_packet->payload.string) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &simple_packet->payload.string, &simple_packet->payload.used, &simple_packet->payload.size); if (F_status_is_error(status)) return status; } @@ -95,8 +95,10 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].payload.string, &array[i].payload.used, &array[i].payload.size); - if (F_status_is_error(status)) return status; + if (array[i].payload.size && array[i].payload.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].payload.string, &array[i].payload.used, &array[i].payload.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -113,8 +115,10 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].payload.string, &array[i].payload.used, &array[i].payload.size); - if (F_status_is_error(status)) return status; + if (array[i].payload.size && array[i].payload.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].payload.string, &array[i].payload.used, &array[i].payload.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -134,11 +138,13 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].payload.string, &array[i].array[j].payload.used, &array[i].array[j].payload.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].payload.size && array[i].array[j].payload.string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].payload.string, &array[i].array[j].payload.used, &array[i].array[j].payload.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_fss_simple_packet_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -161,11 +167,13 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].payload.string, &array[i].array[j].payload.used, &array[i].array[j].payload.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].payload.size && array[i].array[j].payload.string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].payload.string, &array[i].array[j].payload.used, &array[i].array[j].payload.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_fss_simple_packet_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_fss/c/fss/simple_packet.h b/level_0/f_fss/c/fss/simple_packet.h index e1ef287..4ad7516 100644 --- a/level_0/f_fss/c/fss/simple_packet.h +++ b/level_0/f_fss/c/fss/simple_packet.h @@ -116,6 +116,7 @@ extern "C" { #define macro_f_fss_simple_packetss_t_clear(simple_packetss) macro_f_memory_structures_clear(simple_packetss) #endif // _di_f_fss_simple_packetss_t_ + /** * A set of string ranges intending to designate the different ranges for a Simple Packet representing each Block. * diff --git a/level_0/f_iki/c/iki/data.c b/level_0/f_iki/c/iki/data.c index 41af639..788cfb2 100644 --- a/level_0/f_iki/c/iki/data.c +++ b/level_0/f_iki/c/iki/data.c @@ -13,17 +13,27 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &data->content.array, &data->content.used, &data->content.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); - if (F_status_is_error(status)) return status; + if (data->content.size && data->content.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &data->content.array, &data->content.used, &data->content.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &data->variable.array, &data->variable.used, &data->variable.size); - if (F_status_is_error(status)) return status; + if (data->delimits.size && data->delimits.array) { + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &data->vocabulary.array, &data->vocabulary.used, &data->vocabulary.size); - if (F_status_is_error(status)) return status; + if (data->variable.size && data->variable.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &data->variable.array, &data->variable.used, &data->variable.size); + if (F_status_is_error(status)) return status; + } + + if (data->vocabulary.size && data->vocabulary.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &data->vocabulary.array, &data->vocabulary.used, &data->vocabulary.size); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -37,17 +47,27 @@ extern "C" { #endif // _di_level_0_parameter_checking_ { - f_status_t status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &data->content.array, &data->content.used, &data->content.size); - if (F_status_is_error(status)) return status; + f_status_t status = F_okay; - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); - if (F_status_is_error(status)) return status; + if (data->content.size && data->content.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &data->content.array, &data->content.used, &data->content.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &data->variable.array, &data->variable.used, &data->variable.size); - if (F_status_is_error(status)) return status; + if (data->delimits.size && data->delimits.array) { + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &data->delimits.array, &data->delimits.used, &data->delimits.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &data->vocabulary.array, &data->vocabulary.used, &data->vocabulary.size); - if (F_status_is_error(status)) return status; + if (data->variable.size && data->variable.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &data->variable.array, &data->variable.used, &data->variable.size); + if (F_status_is_error(status)) return status; + } + + if (data->vocabulary.size && data->vocabulary.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &data->vocabulary.array, &data->vocabulary.used, &data->vocabulary.size); + if (F_status_is_error(status)) return status; + } } return F_okay; @@ -60,35 +80,37 @@ extern "C" { if (!destination) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - f_status_t status = f_memory_array_increase(F_iki_default_allocation_small_d, sizeof(f_iki_data_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - destination->array[destination->used].content.used = 0; - destination->array[destination->used].delimits.used = 0; - destination->array[destination->used].variable.used = 0; - destination->array[destination->used].vocabulary.used = 0; - - if (source.content.used) { - status = f_string_ranges_append_all(source.content, &destination->array[destination->used].content); + { + f_status_t status = f_memory_array_increase(F_iki_default_allocation_small_d, sizeof(f_iki_data_t), (void **) &destination->array, &destination->used, &destination->size); if (F_status_is_error(status)) return status; - } - if (source.delimits.used) { - for (f_number_unsigned_t i = 0; i < source.delimits.used; ++i) { + destination->array[destination->used].content.used = 0; + destination->array[destination->used].delimits.used = 0; + destination->array[destination->used].variable.used = 0; + destination->array[destination->used].vocabulary.used = 0; - status = f_memory_array_append(source.delimits.array + i, sizeof(f_number_unsigned_t), (void **) &destination->array[destination->used].delimits.array, &destination->array[destination->used].delimits.used, &destination->array[destination->used].delimits.size); + if (source.content.used) { + status = f_string_ranges_append_all(source.content, &destination->array[destination->used].content); if (F_status_is_error(status)) return status; - } // for - } + } - if (source.variable.used) { - status = f_string_ranges_append_all(source.variable, &destination->array[destination->used].variable); - if (F_status_is_error(status)) return status; - } + if (source.delimits.used) { + for (f_number_unsigned_t i = 0; i < source.delimits.used; ++i) { - if (source.vocabulary.used) { - status = f_string_ranges_append_all(source.vocabulary, &destination->array[destination->used].vocabulary); - if (F_status_is_error(status)) return status; + status = f_memory_array_append(source.delimits.array + i, sizeof(f_number_unsigned_t), (void **) &destination->array[destination->used].delimits.array, &destination->array[destination->used].delimits.used, &destination->array[destination->used].delimits.size); + if (F_status_is_error(status)) return status; + } // for + } + + if (source.variable.used) { + status = f_string_ranges_append_all(source.variable, &destination->array[destination->used].variable); + if (F_status_is_error(status)) return status; + } + + if (source.vocabulary.used) { + status = f_string_ranges_append_all(source.vocabulary, &destination->array[destination->used].vocabulary); + if (F_status_is_error(status)) return status; + } } ++destination->used; @@ -118,17 +140,25 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].content.array, &array[i].content.used, &array[i].content.size); - if (F_status_is_error(status)) return status; + if (array[i].content.size && array[i].content.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].content.array, &array[i].content.used, &array[i].content.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].delimits.array, &array[i].delimits.used, &array[i].delimits.size); - if (F_status_is_error(status)) return status; + if (array[i].delimits.size && array[i].delimits.array) { + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].delimits.array, &array[i].delimits.used, &array[i].delimits.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].variable.array, &array[i].variable.used, &array[i].variable.size); - if (F_status_is_error(status)) return status; + if (array[i].variable.size && array[i].variable.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].variable.array, &array[i].variable.used, &array[i].variable.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].vocabulary.array, &array[i].vocabulary.used, &array[i].vocabulary.size); - if (F_status_is_error(status)) return status; + if (array[i].vocabulary.size && array[i].vocabulary.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].vocabulary.array, &array[i].vocabulary.used, &array[i].vocabulary.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -145,17 +175,25 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].content.array, &array[i].content.used, &array[i].content.size); - if (F_status_is_error(status)) return status; + if (array[i].content.size && array[i].content.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].content.array, &array[i].content.used, &array[i].content.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].delimits.array, &array[i].delimits.used, &array[i].delimits.size); - if (F_status_is_error(status)) return status; + if (array[i].delimits.size && array[i].delimits.array) { + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].delimits.array, &array[i].delimits.used, &array[i].delimits.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].variable.array, &array[i].variable.used, &array[i].variable.size); - if (F_status_is_error(status)) return status; + if (array[i].variable.size && array[i].variable.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].variable.array, &array[i].variable.used, &array[i].variable.size); + if (F_status_is_error(status)) return status; + } - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].vocabulary.array, &array[i].vocabulary.used, &array[i].vocabulary.size); - if (F_status_is_error(status)) return status; + if (array[i].vocabulary.size && array[i].vocabulary.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].vocabulary.array, &array[i].vocabulary.used, &array[i].vocabulary.size); + if (F_status_is_error(status)) return status; + } } // for } @@ -224,20 +262,28 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].content.array, &array[i].array[j].content.used, &array[i].array[j].content.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].array[j].delimits.array, &array[i].array[j].delimits.used, &array[i].array[j].delimits.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].variable.array, &array[i].array[j].variable.used, &array[i].array[j].variable.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].vocabulary.array, &array[i].array[j].vocabulary.used, &array[i].array[j].vocabulary.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].content.size && array[i].array[j].content.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].content.array, &array[i].array[j].content.used, &array[i].array[j].content.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].delimits.size && array[i].array[j].delimits.array) { + status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].array[j].delimits.array, &array[i].array[j].delimits.used, &array[i].array[j].delimits.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].variable.size && array[i].array[j].variable.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].variable.array, &array[i].array[j].variable.used, &array[i].array[j].variable.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].vocabulary.size && array[i].array[j].vocabulary.array) { + status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array[j].vocabulary.array, &array[i].array[j].vocabulary.used, &array[i].array[j].vocabulary.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_iki_data_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -260,20 +306,28 @@ extern "C" { for (j = 0; j < array[i].size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].content.array, &array[i].array[j].content.used, &array[i].array[j].content.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].array[j].delimits.array, &array[i].array[j].delimits.used, &array[i].array[j].delimits.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].variable.array, &array[i].array[j].variable.used, &array[i].array[j].variable.size); - if (F_status_is_error(status)) return status; - - status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].vocabulary.array, &array[i].array[j].vocabulary.used, &array[i].array[j].vocabulary.size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].content.size && array[i].array[j].content.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].content.array, &array[i].array[j].content.used, &array[i].array[j].content.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].delimits.size && array[i].array[j].delimits.array) { + status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].array[j].delimits.array, &array[i].array[j].delimits.used, &array[i].array[j].delimits.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].variable.size && array[i].array[j].variable.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].variable.array, &array[i].array[j].variable.used, &array[i].array[j].variable.size); + if (F_status_is_error(status)) return status; + } + + if (array[i].array[j].vocabulary.size && array[i].array[j].vocabulary.array) { + status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array[j].vocabulary.array, &array[i].array[j].vocabulary.used, &array[i].array[j].vocabulary.size); + if (F_status_is_error(status)) return status; + } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_iki_data_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_limit/c/limit/set.c b/level_0/f_limit/c/limit/set.c index 2d49f9c..9d0f895 100644 --- a/level_0/f_limit/c/limit/set.c +++ b/level_0/f_limit/c/limit/set.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_limit_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_limit_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_limit/c/limit/value.c b/level_0/f_limit/c/limit/value.c index f96094f..7bbcafe 100644 --- a/level_0/f_limit/c/limit/value.c +++ b/level_0/f_limit/c/limit/value.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_limit_value_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_limit_value_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_socket/c/socket/address.c b/level_0/f_socket/c/socket/address.c index a61c52d..84a25f2 100644 --- a/level_0/f_socket/c/socket/address.c +++ b/level_0/f_socket/c/socket/address.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_socket_address_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_socket_address_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_socket/c/socket/socket.c b/level_0/f_socket/c/socket/socket.c index f885ac8..25fc8c1 100644 --- a/level_0/f_socket/c/socket/socket.c +++ b/level_0/f_socket/c/socket/socket.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_socket_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_socket_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_string/c/string/dynamics.c b/level_0/f_string/c/string/dynamics.c index ddc20dc..326e24d 100644 --- a/level_0/f_string/c/string/dynamics.c +++ b/level_0/f_string/c/string/dynamics.c @@ -67,7 +67,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].string, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -87,7 +87,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].string, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_string/c/string/dynamicss.c b/level_0/f_string/c/string/dynamicss.c index 0879d1a..7c9aec3 100644 --- a/level_0/f_string/c/string/dynamicss.c +++ b/level_0/f_string/c/string/dynamicss.c @@ -89,10 +89,10 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].size) { + if (array[i].array[j].size && array[i].array[j].string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].string, &array[i].array[j].used, &array[i].array[j].size); if (F_status_is_error(status)) return status; } @@ -118,10 +118,10 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].size) { + if (array[i].array[j].size && array[i].array[j].string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].string, &array[i].array[j].used, &array[i].array[j].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_string/c/string/map_multis.c b/level_0/f_string/c/string/map_multis.c index 375faea..3f22244 100644 --- a/level_0/f_string/c/string/map_multis.c +++ b/level_0/f_string/c/string/map_multis.c @@ -104,16 +104,18 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].name.size) { + if (array[i].name.size && array[i].name.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); if (F_status_is_error(status)) return status; } - if (array[i].value.size) { + if (array[i].value.size && array[i].value.array) { for (j = 0; j < array[i].value.size; ++j) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].value.array[j].string, &array[i].value.array[j].used, &array[i].value.array[j].size); - if (F_status_is_error(status)) return status; + if (array[i].value.array[j].size && array[i].value.array[j].string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].value.array[j].string, &array[i].value.array[j].used, &array[i].value.array[j].size); + if (F_status_is_error(status)) return status; + } } // for status = f_memory_array_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].value.array, &array[i].value.used, &array[i].value.size); @@ -136,16 +138,18 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].name.size) { + if (array[i].name.size && array[i].name.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); if (F_status_is_error(status)) return status; } - if (array[i].value.size) { + if (array[i].value.size && array[i].value.array) { for (j = 0; j < array[i].value.size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].value.array[j].string, &array[i].value.array[j].used, &array[i].value.array[j].size); - if (F_status_is_error(status)) return status; + if (array[i].value.array[j].size && array[i].value.array[j].string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].value.array[j].string, &array[i].value.array[j].used, &array[i].value.array[j].size); + if (F_status_is_error(status)) return status; + } } // for status = f_memory_array_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].value.array, &array[i].value.used, &array[i].value.size); diff --git a/level_0/f_string/c/string/map_multiss.c b/level_0/f_string/c/string/map_multiss.c index 448ceae..bb9c33b 100644 --- a/level_0/f_string/c/string/map_multiss.c +++ b/level_0/f_string/c/string/map_multiss.c @@ -136,17 +136,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { if (array[i].array[j].name.size) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].value.size) { + if (array[i].array[j].value.size && array[i].array[j].value.array) { for (k = 0; k < array[i].array[j].value.size; ++k) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].value.array[k].string, &array[i].array[j].value.array[k].used, &array[i].array[j].value.array[k].size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].value.array[k].size && array[i].array[j].value.array[k].string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].value.array[k].string, &array[i].array[j].value.array[k].used, &array[i].array[j].value.array[k].size); + if (F_status_is_error(status)) return status; + } } // for status = f_memory_array_resize(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].value.array, &array[i].array[j].value.used, &array[i].array[j].value.size); @@ -174,17 +176,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { - if (array[i].array[j].name.size) { + if (array[i].size && array[i].array) { + if (array[i].array[j].name.size && array[i].array[j].name.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].value.size) { + if (array[i].array[j].value.size && array[i].array[j].value.array) { for (k = 0; k < array[i].array[j].value.size; ++k) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].value.array[k].string, &array[i].array[j].value.array[k].used, &array[i].array[j].value.array[k].size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].value.array[k].size && array[i].array[j].value.array[k].string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].value.array[k].string, &array[i].array[j].value.array[k].used, &array[i].array[j].value.array[k].size); + if (F_status_is_error(status)) return status; + } } // for status = f_memory_array_adjust(0, sizeof(f_string_dynamic_t), (void **) &array[i].array[j].value.array, &array[i].array[j].value.used, &array[i].array[j].value.size); diff --git a/level_0/f_string/c/string/maps.c b/level_0/f_string/c/string/maps.c index 1f6faac..c1f8c62 100644 --- a/level_0/f_string/c/string/maps.c +++ b/level_0/f_string/c/string/maps.c @@ -77,12 +77,12 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].name.size) { + if (array[i].name.size && array[i].name.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); if (F_status_is_error(status)) return status; } - if (array[i].value.size) { + if (array[i].value.size && array[i].value.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].value.string, &array[i].value.used, &array[i].value.size); if (F_status_is_error(status)) return status; } @@ -102,12 +102,12 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].name.size) { + if (array[i].name.size && array[i].name.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); if (F_status_is_error(status)) return status; } - if (array[i].value.size) { + if (array[i].value.size && array[i].value.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].value.string, &array[i].value.used, &array[i].value.size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_string/c/string/mapss.c b/level_0/f_string/c/string/mapss.c index 7454a90..a5dde7b 100644 --- a/level_0/f_string/c/string/mapss.c +++ b/level_0/f_string/c/string/mapss.c @@ -106,15 +106,15 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].name.size) { + if (array[i].array[j].name.size && array[i].array[j].name.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].value.size) { + if (array[i].array[j].value.size && array[i].array[j].value.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].value.string, &array[i].array[j].value.used, &array[i].array[j].value.size); if (F_status_is_error(status)) return status; } @@ -140,15 +140,15 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].name.size) { + if (array[i].array[j].name.size && array[i].array[j].name.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].value.size) { + if (array[i].array[j].value.size && array[i].array[j].value.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].value.string, &array[i].array[j].value.used, &array[i].array[j].value.size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_string/c/string/quantityss.c b/level_0/f_string/c/string/quantityss.c index 3346cdf..72a1ec3 100644 --- a/level_0/f_string/c/string/quantityss.c +++ b/level_0/f_string/c/string/quantityss.c @@ -84,7 +84,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_string_quantity_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -104,7 +104,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_string_quantity_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_string/c/string/rangess.c b/level_0/f_string/c/string/rangess.c index 0f1ff8f..9d4d673 100644 --- a/level_0/f_string/c/string/rangess.c +++ b/level_0/f_string/c/string/rangess.c @@ -84,7 +84,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -104,7 +104,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_string/c/string/triples.c b/level_0/f_string/c/string/triples.c index 3b17dbc..b741012 100644 --- a/level_0/f_string/c/string/triples.c +++ b/level_0/f_string/c/string/triples.c @@ -19,17 +19,17 @@ extern "C" { destination->array[destination->used].b.used = 0; destination->array[destination->used].c.used = 0; - if (source.a.used) { + if (source.a.used && source.a.string) { status = private_f_string_append(source.a.string, source.a.used, &destination->array[destination->used].a); if (F_status_is_error(status)) return status; } - if (source.b.used) { + if (source.b.used && source.b.string) { status = private_f_string_append(source.b.string, source.b.used, &destination->array[destination->used].b); if (F_status_is_error(status)) return status; } - if (source.c.used) { + if (source.c.used && source.c.string) { status = private_f_string_append(source.c.string, source.c.used, &destination->array[destination->used].c); if (F_status_is_error(status)) return status; } @@ -59,17 +59,17 @@ extern "C" { destination->array[destination->used].b.used = 0; destination->array[destination->used].c.used = 0; - if (source.array[i].a.used) { + if (source.array[i].a.used && source.array[i].a.string) { status = private_f_string_append(source.array[i].a.string, source.array[i].a.used, &destination->array[destination->used].a); if (F_status_is_error(status)) return status; } - if (source.array[i].b.used) { + if (source.array[i].b.used && source.array[i].b.string) { status = private_f_string_append(source.array[i].b.string, source.array[i].b.used, &destination->array[destination->used].b); if (F_status_is_error(status)) return status; } - if (source.array[i].c.used) { + if (source.array[i].c.used && source.array[i].c.string) { status = private_f_string_append(source.array[i].c.string, source.array[i].c.used, &destination->array[destination->used].c); if (F_status_is_error(status)) return status; } @@ -89,17 +89,17 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].a.size) { + if (array[i].a.size && array[i].a.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].a.string, &array[i].a.used, &array[i].a.size); if (F_status_is_error(status)) return status; } - if (array[i].b.size) { + if (array[i].b.size && array[i].b.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].b.string, &array[i].b.used, &array[i].b.size); if (F_status_is_error(status)) return status; } - if (array[i].c.size) { + if (array[i].c.size && array[i].c.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].c.string, &array[i].c.used, &array[i].c.size); if (F_status_is_error(status)) return status; } @@ -119,17 +119,17 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].a.size) { + if (array[i].a.size && array[i].a.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].a.string, &array[i].a.used, &array[i].a.size); if (F_status_is_error(status)) return status; } - if (array[i].b.size) { + if (array[i].b.size && array[i].b.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].b.string, &array[i].b.used, &array[i].b.size); if (F_status_is_error(status)) return status; } - if (array[i].c.size) { + if (array[i].c.size && array[i].c.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].c.string, &array[i].c.used, &array[i].c.size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_string/c/string/tripless.c b/level_0/f_string/c/string/tripless.c index e46d130..5ec1258 100644 --- a/level_0/f_string/c/string/tripless.c +++ b/level_0/f_string/c/string/tripless.c @@ -117,20 +117,20 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].a.size) { + if (array[i].array[j].a.size && array[i].array[j].a.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].a.string, &array[i].array[j].a.used, &array[i].array[j].a.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].b.size) { + if (array[i].array[j].b.size && array[i].array[j].b.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].b.string, &array[i].array[j].b.used, &array[i].array[j].b.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].c.size) { + if (array[i].array[j].c.size && array[i].array[j].c.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].c.string, &array[i].array[j].c.used, &array[i].array[j].c.size); if (F_status_is_error(status)) return status; } @@ -156,20 +156,20 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].a.size) { + if (array[i].array[j].a.size && array[i].array[j].a.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].a.string, &array[i].array[j].a.used, &array[i].array[j].a.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].b.size) { + if (array[i].array[j].b.size && array[i].array[j].b.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].b.string, &array[i].array[j].b.used, &array[i].array[j].b.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].c.size) { + if (array[i].array[j].c.size && array[i].array[j].c.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].c.string, &array[i].array[j].c.used, &array[i].array[j].c.size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/attribute.c b/level_0/f_thread/c/thread/attribute.c index 148d69b..f6fc070 100644 --- a/level_0/f_thread/c/thread/attribute.c +++ b/level_0/f_thread/c/thread/attribute.c @@ -48,7 +48,7 @@ extern "C" { if (pthread_attr_destroy(&array[i].array[j])) return F_status_set_error(F_failure); } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -72,7 +72,7 @@ extern "C" { if (pthread_attr_destroy(&array[i].array[j])) return F_status_set_error(F_failure); } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/barrier.c b/level_0/f_thread/c/thread/barrier.c index 31e470a..d6108e1 100644 --- a/level_0/f_thread/c/thread/barrier.c +++ b/level_0/f_thread/c/thread/barrier.c @@ -75,7 +75,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -108,7 +108,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/barrier_attribute.c b/level_0/f_thread/c/thread/barrier_attribute.c index e9cec2f..d409420 100644 --- a/level_0/f_thread/c/thread/barrier_attribute.c +++ b/level_0/f_thread/c/thread/barrier_attribute.c @@ -48,7 +48,7 @@ extern "C" { if (pthread_barrierattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure); } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_barrier_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -72,7 +72,7 @@ extern "C" { if (pthread_barrierattr_destroy(&array[i].array[j])) return F_status_set_error(F_failure); } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_barrier_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/condition.c b/level_0/f_thread/c/thread/condition.c index 01c7a41..c23ab10 100644 --- a/level_0/f_thread/c/thread/condition.c +++ b/level_0/f_thread/c/thread/condition.c @@ -75,7 +75,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -108,7 +108,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/condition_attribute.c b/level_0/f_thread/c/thread/condition_attribute.c index af1bfd7..6b98d52 100644 --- a/level_0/f_thread/c/thread/condition_attribute.c +++ b/level_0/f_thread/c/thread/condition_attribute.c @@ -75,7 +75,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_condition_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -108,7 +108,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_condition_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/key.c b/level_0/f_thread/c/thread/key.c index 23136d0..fbe1321 100644 --- a/level_0/f_thread/c/thread/key.c +++ b/level_0/f_thread/c/thread/key.c @@ -57,7 +57,7 @@ extern "C" { array[i].array[j] = 0; } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_key_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -84,7 +84,7 @@ extern "C" { array[i].array[j] = 0; } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_key_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/lock.c b/level_0/f_thread/c/thread/lock.c index 607fe4e..1b4f0a5 100644 --- a/level_0/f_thread/c/thread/lock.c +++ b/level_0/f_thread/c/thread/lock.c @@ -75,7 +75,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -108,7 +108,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/lock_attribute.c b/level_0/f_thread/c/thread/lock_attribute.c index 5033f1b..2ceb7cc 100644 --- a/level_0/f_thread/c/thread/lock_attribute.c +++ b/level_0/f_thread/c/thread/lock_attribute.c @@ -75,7 +75,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_lock_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -108,7 +108,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_lock_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/mutex.c b/level_0/f_thread/c/thread/mutex.c index 5b05e79..acffaaa 100644 --- a/level_0/f_thread/c/thread/mutex.c +++ b/level_0/f_thread/c/thread/mutex.c @@ -75,7 +75,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -108,7 +108,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/mutex_attribute.c b/level_0/f_thread/c/thread/mutex_attribute.c index d7e6a90..583ec5e 100644 --- a/level_0/f_thread/c/thread/mutex_attribute.c +++ b/level_0/f_thread/c/thread/mutex_attribute.c @@ -75,7 +75,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_mutex_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -108,7 +108,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_mutex_attribute_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/semaphore.c b/level_0/f_thread/c/thread/semaphore.c index 15ee808..95686a8 100644 --- a/level_0/f_thread/c/thread/semaphore.c +++ b/level_0/f_thread/c/thread/semaphore.c @@ -48,7 +48,7 @@ extern "C" { if (sem_destroy(&array[i].array[j]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_semaphore_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -72,7 +72,7 @@ extern "C" { if (sem_destroy(&array[i].array[j]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_semaphore_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/set.c b/level_0/f_thread/c/thread/set.c index 9085f1e..69181f7 100644 --- a/level_0/f_thread/c/thread/set.c +++ b/level_0/f_thread/c/thread/set.c @@ -48,7 +48,7 @@ extern "C" { if (pthread_attr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure); } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -72,7 +72,7 @@ extern "C" { if (pthread_attr_destroy(&array[i].array[j].attribute)) return F_status_set_error(F_failure); } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_set_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_thread/c/thread/spin.c b/level_0/f_thread/c/thread/spin.c index 5db5748..59da31a 100644 --- a/level_0/f_thread/c/thread/spin.c +++ b/level_0/f_thread/c/thread/spin.c @@ -75,7 +75,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_resize(0, sizeof(f_thread_spin_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -108,7 +108,7 @@ extern "C" { } } // for - if (array[i].size) { + if (array[i].size && array[i].array) { const f_status_t status = f_memory_array_adjust(0, sizeof(f_thread_spin_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/cell.c b/level_0/f_type_array/c/type_array/cell.c index 5ee3378..d32981d 100644 --- a/level_0/f_type_array/c/type_array/cell.c +++ b/level_0/f_type_array/c/type_array/cell.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_cell_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_cell_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/file.c b/level_0/f_type_array/c/type_array/file.c index 5a268cb..0bb362e 100644 --- a/level_0/f_type_array/c/type_array/file.c +++ b/level_0/f_type_array/c/type_array/file.c @@ -15,7 +15,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_file_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -35,7 +35,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_file_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/fll_id.c b/level_0/f_type_array/c/type_array/fll_id.c index e28a5ae..c7add6a 100644 --- a/level_0/f_type_array/c/type_array/fll_id.c +++ b/level_0/f_type_array/c/type_array/fll_id.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_fll_id_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_fll_id_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/int128.c b/level_0/f_type_array/c/type_array/int128.c index 1a1fd95..918b086 100644 --- a/level_0/f_type_array/c/type_array/int128.c +++ b/level_0/f_type_array/c/type_array/int128.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_int128_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_int128_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/int16.c b/level_0/f_type_array/c/type_array/int16.c index ef5481b..31f1346 100644 --- a/level_0/f_type_array/c/type_array/int16.c +++ b/level_0/f_type_array/c/type_array/int16.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(int16_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(int16_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/int32.c b/level_0/f_type_array/c/type_array/int32.c index b93a858..57be98a 100644 --- a/level_0/f_type_array/c/type_array/int32.c +++ b/level_0/f_type_array/c/type_array/int32.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(int32_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(int32_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/int8.c b/level_0/f_type_array/c/type_array/int8.c index 6bf8d9d..e02fc17 100644 --- a/level_0/f_type_array/c/type_array/int8.c +++ b/level_0/f_type_array/c/type_array/int8.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(int8_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(int8_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/number_unsigned.c b/level_0/f_type_array/c/type_array/number_unsigned.c index a379bdc..86148b8 100644 --- a/level_0/f_type_array/c/type_array/number_unsigned.c +++ b/level_0/f_type_array/c/type_array/number_unsigned.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_number_unsigned_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_number_unsigned_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/poll.c b/level_0/f_type_array/c/type_array/poll.c index f5c589c..c4bb80d 100644 --- a/level_0/f_type_array/c/type_array/poll.c +++ b/level_0/f_type_array/c/type_array/poll.c @@ -15,7 +15,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_poll_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -35,7 +35,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_poll_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/state.c b/level_0/f_type_array/c/type_array/state.c index 9c140b6..8f2f67f 100644 --- a/level_0/f_type_array/c/type_array/state.c +++ b/level_0/f_type_array/c/type_array/state.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_state_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_state_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/status.c b/level_0/f_type_array/c/type_array/status.c index 5807a93..b2b0fa3 100644 --- a/level_0/f_type_array/c/type_array/status.c +++ b/level_0/f_type_array/c/type_array/status.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(f_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(f_status_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/uint16.c b/level_0/f_type_array/c/type_array/uint16.c index fcd1f16..fdcf230 100644 --- a/level_0/f_type_array/c/type_array/uint16.c +++ b/level_0/f_type_array/c/type_array/uint16.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(uint16_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(uint16_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/uint32.c b/level_0/f_type_array/c/type_array/uint32.c index f19b38a..c35226c 100644 --- a/level_0/f_type_array/c/type_array/uint32.c +++ b/level_0/f_type_array/c/type_array/uint32.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(uint32_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(uint32_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_type_array/c/type_array/uint64.c b/level_0/f_type_array/c/type_array/uint64.c index c7c95bf..bdb427f 100644 --- a/level_0/f_type_array/c/type_array/uint64.c +++ b/level_0/f_type_array/c/type_array/uint64.c @@ -14,7 +14,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_resize(0, sizeof(uint64_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -34,7 +34,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { status = f_memory_array_adjust(0, sizeof(uint64_t), (void **) &array[i].array, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_utf/c/utf/dynamics.c b/level_0/f_utf/c/utf/dynamics.c index c001265..f115620 100644 --- a/level_0/f_utf/c/utf/dynamics.c +++ b/level_0/f_utf/c/utf/dynamics.c @@ -41,7 +41,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].string, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } @@ -61,7 +61,7 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].string, &array[i].used, &array[i].size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_utf/c/utf/dynamicss.c b/level_0/f_utf/c/utf/dynamicss.c index ba64bc8..989c9c6 100644 --- a/level_0/f_utf/c/utf/dynamicss.c +++ b/level_0/f_utf/c/utf/dynamicss.c @@ -71,17 +71,17 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].size) { + if (array[i].array[j].size && array[i].array[j].string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].string, &array[i].array[j].used, &array[i].array[j].size); if (F_status_is_error(status)) return status; } - - status = f_memory_array_resize(0, sizeof(f_utf_string_dynamic_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; } // for + + status = f_memory_array_resize(0, sizeof(f_utf_string_dynamic_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; } } // for } @@ -100,17 +100,17 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].size) { + if (array[i].array[j].size && array[i].array[j].string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].string, &array[i].array[j].used, &array[i].array[j].size); if (F_status_is_error(status)) return status; } - - status = f_memory_array_adjust(0, sizeof(f_utf_string_dynamic_t), (void **) &array[i].array, &array[i].used, &array[i].size); - if (F_status_is_error(status)) return status; } // for + + status = f_memory_array_adjust(0, sizeof(f_utf_string_dynamic_t), (void **) &array[i].array, &array[i].used, &array[i].size); + if (F_status_is_error(status)) return status; } } // for } diff --git a/level_0/f_utf/c/utf/map_multis.c b/level_0/f_utf/c/utf/map_multis.c index 822e566..7d159c2 100644 --- a/level_0/f_utf/c/utf/map_multis.c +++ b/level_0/f_utf/c/utf/map_multis.c @@ -60,16 +60,18 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].name.size) { + if (array[i].name.size && array[i].name.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); if (F_status_is_error(status)) return status; } - if (array[i].value.size) { + if (array[i].value.size && array[i].value.array) { for (j = 0; j < array[i].value.size; ++j) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].value.array[j].string, &array[i].value.array[j].used, &array[i].value.array[j].size); - if (F_status_is_error(status)) return status; + if (array[i].value.array[j].size && array[i].value.array[j].string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].value.array[j].string, &array[i].value.array[j].used, &array[i].value.array[j].size); + if (F_status_is_error(status)) return status; + } } // for status = f_memory_array_resize(0, sizeof(f_utf_string_dynamic_t), (void **) &array[i].value.array, &array[i].value.used, &array[i].value.size); @@ -92,16 +94,18 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].name.size) { + if (array[i].name.size && array[i].name.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); if (F_status_is_error(status)) return status; } - if (array[i].value.size) { + if (array[i].value.size && array[i].value.array) { for (j = 0; j < array[i].value.size; ++j) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].value.array[j].string, &array[i].value.array[j].used, &array[i].value.array[j].size); - if (F_status_is_error(status)) return status; + if (array[i].value.array[j].size && array[i].value.array[j].string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].value.array[j].string, &array[i].value.array[j].used, &array[i].value.array[j].size); + if (F_status_is_error(status)) return status; + } } // for status = f_memory_array_adjust(0, sizeof(f_utf_string_dynamic_t), (void **) &array[i].value.array, &array[i].value.used, &array[i].value.size); diff --git a/level_0/f_utf/c/utf/map_multiss.c b/level_0/f_utf/c/utf/map_multiss.c index c1c396c..30559fc 100644 --- a/level_0/f_utf/c/utf/map_multiss.c +++ b/level_0/f_utf/c/utf/map_multiss.c @@ -71,17 +71,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { - if (array[i].array[j].name.size) { + if (array[i].size && array[i].array) { + if (array[i].array[j].name.size && array[i].array[j].name.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].value.size) { + if (array[i].array[j].value.size && array[i].array[j].value.array) { for (k = 0; k < array[i].array[j].value.size; ++k) { - status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].value.array[k].string, &array[i].array[j].value.array[k].used, &array[i].array[j].value.array[k].size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].value.array[k].size && array[i].array[j].value.array[k].string) { + status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].value.array[k].string, &array[i].array[j].value.array[k].used, &array[i].array[j].value.array[k].size); + if (F_status_is_error(status)) return status; + } } // for status = f_memory_array_resize(0, sizeof(f_utf_string_dynamic_t), (void **) &array[i].array[j].value.array, &array[i].array[j].value.used, &array[i].array[j].value.size); @@ -109,17 +111,19 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { - if (array[i].array[j].name.size) { + if (array[i].size && array[i].array) { + if (array[i].array[j].name.size && array[i].array[j].name.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].value.size) { + if (array[i].array[j].value.size && array[i].array[j].value.array) { for (k = 0; k < array[i].array[j].value.size; ++k) { - status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].value.array[k].string, &array[i].array[j].value.array[k].used, &array[i].array[j].value.array[k].size); - if (F_status_is_error(status)) return status; + if (array[i].array[j].value.array[k].size && array[i].array[j].value.array[k].string) { + status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].value.array[k].string, &array[i].array[j].value.array[k].used, &array[i].array[j].value.array[k].size); + if (F_status_is_error(status)) return status; + } } // for status = f_memory_array_adjust(0, sizeof(f_utf_string_dynamic_t), (void **) &array[i].array[j].value.array, &array[i].array[j].value.used, &array[i].array[j].value.size); diff --git a/level_0/f_utf/c/utf/maps.c b/level_0/f_utf/c/utf/maps.c index ba9a609..88b1efe 100644 --- a/level_0/f_utf/c/utf/maps.c +++ b/level_0/f_utf/c/utf/maps.c @@ -57,12 +57,12 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].name.size) { + if (array[i].name.size && array[i].name.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); if (F_status_is_error(status)) return status; } - if (array[i].value.size) { + if (array[i].value.size && array[i].value.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].value.string, &array[i].value.used, &array[i].value.size); if (F_status_is_error(status)) return status; } @@ -82,12 +82,12 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].name.size) { + if (array[i].name.size && array[i].name.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].name.string, &array[i].name.used, &array[i].name.size); if (F_status_is_error(status)) return status; } - if (array[i].value.size) { + if (array[i].value.size && array[i].value.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].value.string, &array[i].value.used, &array[i].value.size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_utf/c/utf/mapss.c b/level_0/f_utf/c/utf/mapss.c index febf112..e0cac98 100644 --- a/level_0/f_utf/c/utf/mapss.c +++ b/level_0/f_utf/c/utf/mapss.c @@ -70,15 +70,15 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].name.size) { + if (array[i].array[j].name.size && array[i].array[j].name.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].value.size) { + if (array[i].array[j].value.size && array[i].array[j].value.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].value.string, &array[i].array[j].value.used, &array[i].array[j].value.size); if (F_status_is_error(status)) return status; } @@ -104,15 +104,15 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].name.size) { + if (array[i].array[j].name.size && array[i].array[j].name.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].name.string, &array[i].array[j].name.used, &array[i].array[j].name.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].value.size) { + if (array[i].array[j].value.size && array[i].array[j].value.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].value.string, &array[i].array[j].value.used, &array[i].array[j].value.size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_utf/c/utf/triples.c b/level_0/f_utf/c/utf/triples.c index c312cc5..11bda73 100644 --- a/level_0/f_utf/c/utf/triples.c +++ b/level_0/f_utf/c/utf/triples.c @@ -91,17 +91,17 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].a.size) { + if (array[i].a.size && array[i].a.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].a.string, &array[i].a.used, &array[i].a.size); if (F_status_is_error(status)) return status; } - if (array[i].b.size) { + if (array[i].b.size && array[i].b.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].b.string, &array[i].b.used, &array[i].b.size); if (F_status_is_error(status)) return status; } - if (array[i].c.size) { + if (array[i].c.size && array[i].c.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].c.string, &array[i].c.used, &array[i].c.size); if (F_status_is_error(status)) return status; } @@ -121,17 +121,17 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].a.size) { + if (array[i].a.size && array[i].a.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].a.string, &array[i].a.used, &array[i].a.size); if (F_status_is_error(status)) return status; } - if (array[i].b.size) { + if (array[i].b.size && array[i].b.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].b.string, &array[i].b.used, &array[i].b.size); if (F_status_is_error(status)) return status; } - if (array[i].c.size) { + if (array[i].c.size && array[i].c.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].c.string, &array[i].c.used, &array[i].c.size); if (F_status_is_error(status)) return status; } diff --git a/level_0/f_utf/c/utf/tripless.c b/level_0/f_utf/c/utf/tripless.c index 9701859..a7d190f 100644 --- a/level_0/f_utf/c/utf/tripless.c +++ b/level_0/f_utf/c/utf/tripless.c @@ -74,20 +74,20 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].a.size) { + if (array[i].array[j].a.size && array[i].array[j].a.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].a.string, &array[i].array[j].a.used, &array[i].array[j].a.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].b.size) { + if (array[i].array[j].b.size && array[i].array[j].b.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].b.string, &array[i].array[j].b.used, &array[i].array[j].b.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].c.size) { + if (array[i].array[j].c.size && array[i].array[j].c.string) { status = f_memory_array_resize(0, sizeof(f_char_t), (void **) &array[i].array[j].c.string, &array[i].array[j].c.used, &array[i].array[j].c.size); if (F_status_is_error(status)) return status; } @@ -113,20 +113,20 @@ extern "C" { for (f_number_unsigned_t i = start; i < stop; ++i) { - if (array[i].size) { + if (array[i].size && array[i].array) { for (j = 0; j < array[i].size; ++j) { - if (array[i].array[j].a.size) { + if (array[i].array[j].a.size && array[i].array[j].a.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].a.string, &array[i].array[j].a.used, &array[i].array[j].a.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].b.size) { + if (array[i].array[j].b.size && array[i].array[j].b.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].b.string, &array[i].array[j].b.used, &array[i].array[j].b.size); if (F_status_is_error(status)) return status; } - if (array[i].array[j].c.size) { + if (array[i].array[j].c.size && array[i].array[j].c.string) { status = f_memory_array_adjust(0, sizeof(f_char_t), (void **) &array[i].array[j].c.string, &array[i].array[j].c.used, &array[i].array[j].c.size); if (F_status_is_error(status)) return status; } -- 1.8.3.1