From 2a7e517703cb8cf41fc0ae0edda7f7ef52c6d655 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 7 Aug 2023 23:33:35 -0500 Subject: [PATCH] Progress: Continue re-designing of the memory logic. --- build/level_0/settings | 3 +- build/monolithic/settings | 3 +- build/stand_alone/byte_dump.settings | 3 +- build/stand_alone/fake.settings | 5 +- build/stand_alone/firewall.settings | 3 +- build/stand_alone/utf8.settings | 3 +- level_0/f_thread/c/thread.c | 86 ++++- level_0/f_thread/c/thread.h | 2 +- level_0/f_thread/c/thread/attribute.c | 41 ++- level_0/f_thread/c/thread/id.c | 1 - level_0/f_thread/c/thread/key.c | 59 +++- level_0/f_thread/c/thread/lock.c | 113 +++++- level_0/f_thread/c/thread/lock_attribute.c | 113 +++++- level_0/f_thread/c/thread/mutex.c | 113 +++++- level_0/f_thread/c/thread/mutex_attribute.c | 113 +++++- level_0/f_thread/c/thread/once.c | 1 - level_0/f_thread/c/thread/private-attribute.c | 49 --- level_0/f_thread/c/thread/private-attribute.h | 342 ------------------ level_0/f_thread/c/thread/private-id.c | 10 - level_0/f_thread/c/thread/private-id.h | 22 -- level_0/f_thread/c/thread/private-key.c | 51 --- level_0/f_thread/c/thread/private-key.h | 100 ------ level_0/f_thread/c/thread/private-lock.c | 56 --- level_0/f_thread/c/thread/private-lock.h | 101 ------ level_0/f_thread/c/thread/private-lock_attribute.c | 56 --- level_0/f_thread/c/thread/private-lock_attribute.h | 100 ------ level_0/f_thread/c/thread/private-mutex.c | 56 --- level_0/f_thread/c/thread/private-mutex.h | 101 ------ .../f_thread/c/thread/private-mutex_attribute.c | 56 --- .../f_thread/c/thread/private-mutex_attribute.h | 100 ------ level_0/f_thread/c/thread/private-semaphore.c | 55 --- level_0/f_thread/c/thread/private-semaphore.h | 100 ------ level_0/f_thread/c/thread/private-set.c | 41 --- level_0/f_thread/c/thread/private-set.h | 71 ---- level_0/f_thread/c/thread/private-spin.c | 56 --- level_0/f_thread/c/thread/private-spin.h | 100 ------ level_0/f_thread/c/thread/semaphore.c | 41 ++- level_0/f_thread/c/thread/set.c | 41 ++- level_0/f_thread/c/thread/spin.c | 113 +++++- level_0/f_thread/data/build/settings | 2 +- level_0/f_thread/data/build/settings-mocks | 2 +- level_0/f_type_array/c/type_array/poll.c | 224 ++---------- level_0/f_type_array/c/type_array/poll.h | 382 ++------------------- level_0/f_type_array/c/type_array/private-poll.c | 71 ---- level_0/f_type_array/c/type_array/private-poll.h | 131 ------- level_0/f_type_array/c/type_array/private-state.c | 70 ---- level_0/f_type_array/c/type_array/private-state.h | 131 ------- level_0/f_type_array/c/type_array/private-status.c | 70 ---- level_0/f_type_array/c/type_array/private-status.h | 131 ------- level_0/f_type_array/c/type_array/state.c | 224 ++---------- level_0/f_type_array/c/type_array/state.h | 382 ++------------------- level_0/f_type_array/c/type_array/status.c | 224 ++---------- level_0/f_type_array/c/type_array/status.h | 382 ++------------------- level_0/f_type_array/data/build/settings | 1 - level_0/f_type_array/data/build/settings-mocks | 1 - level_0/f_type_array/data/build/settings-tests | 3 + .../unit/c/test-type_array-polls_adjust_callback.c | 45 +++ .../unit/c/test-type_array-polls_adjust_callback.h | 27 ++ .../unit/c/test-type_array-polls_resize_callback.c | 45 +++ .../unit/c/test-type_array-polls_resize_callback.h | 27 ++ .../c/test-type_array-states_adjust_callback.c | 45 +++ .../c/test-type_array-states_adjust_callback.h | 27 ++ .../c/test-type_array-states_resize_callback.c | 45 +++ .../c/test-type_array-states_resize_callback.h | 27 ++ .../c/test-type_array-statuss_adjust_callback.c | 45 +++ .../c/test-type_array-statuss_adjust_callback.h | 27 ++ .../c/test-type_array-statuss_resize_callback.c | 45 +++ .../c/test-type_array-statuss_resize_callback.h | 27 ++ .../f_type_array/tests/unit/c/test-type_array.c | 27 ++ .../f_type_array/tests/unit/c/test-type_array.h | 6 + 70 files changed, 1372 insertions(+), 4004 deletions(-) delete mode 100644 level_0/f_thread/c/thread/private-attribute.c delete mode 100644 level_0/f_thread/c/thread/private-attribute.h delete mode 100644 level_0/f_thread/c/thread/private-id.c delete mode 100644 level_0/f_thread/c/thread/private-id.h delete mode 100644 level_0/f_thread/c/thread/private-key.c delete mode 100644 level_0/f_thread/c/thread/private-key.h delete mode 100644 level_0/f_thread/c/thread/private-lock.c delete mode 100644 level_0/f_thread/c/thread/private-lock.h delete mode 100644 level_0/f_thread/c/thread/private-lock_attribute.c delete mode 100644 level_0/f_thread/c/thread/private-lock_attribute.h delete mode 100644 level_0/f_thread/c/thread/private-mutex.c delete mode 100644 level_0/f_thread/c/thread/private-mutex.h delete mode 100644 level_0/f_thread/c/thread/private-mutex_attribute.c delete mode 100644 level_0/f_thread/c/thread/private-mutex_attribute.h delete mode 100644 level_0/f_thread/c/thread/private-semaphore.c delete mode 100644 level_0/f_thread/c/thread/private-semaphore.h delete mode 100644 level_0/f_thread/c/thread/private-set.c delete mode 100644 level_0/f_thread/c/thread/private-set.h delete mode 100644 level_0/f_thread/c/thread/private-spin.c delete mode 100644 level_0/f_thread/c/thread/private-spin.h delete mode 100644 level_0/f_type_array/c/type_array/private-poll.c delete mode 100644 level_0/f_type_array/c/type_array/private-poll.h delete mode 100644 level_0/f_type_array/c/type_array/private-state.c delete mode 100644 level_0/f_type_array/c/type_array/private-state.h delete mode 100644 level_0/f_type_array/c/type_array/private-status.c delete mode 100644 level_0/f_type_array/c/type_array/private-status.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.h create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.c create mode 100644 level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.h diff --git a/build/level_0/settings b/build/level_0/settings index fed5c00..5b70fde 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -77,7 +77,6 @@ build_sources_library string/static.c string/statics.c string/staticss.c build_sources_library string/triple.c string/triples.c string/tripless.c build_sources_library time.c build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_unsigned.c type_array/poll.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c -build_sources_library type_array/private-poll.c type_array/private-state.c type_array/private-status.c build_sources_library utf.c private-utf.c private-utf_alphabetic.c private-utf_combining.c private-utf_control.c private-utf_digit.c private-utf_emoji.c private-utf_numeric.c private-utf_phonetic.c private-utf_private.c private-utf_punctuation.c private-utf_subscript.c private-utf_superscript.c private-utf_symbol.c private-utf_unassigned.c private-utf_valid.c private-utf_whitespace.c private-utf_wide.c private-utf_word.c private-utf_zero_width.c build_sources_library utf/common.c utf/convert.c build_sources_library utf/dynamic.c utf/dynamics.c utf/dynamicss.c @@ -93,7 +92,7 @@ build_sources_library utf/private-string.c build_sources_library utf/private-triples.c utf/private-tripless.c build_sources_library-thread thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/condition.c thread/condition_attribute.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/mutex.c thread/mutex_attribute.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c -build_sources_library-thread thread/private-attribute.c thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c thread/private-id.c thread/private-key.c thread/private-lock.c thread/private-lock_attribute.c thread/private-mutex.c thread/private-mutex_attribute.c thread/private-once.c thread/private-semaphore.c thread/private-set.c thread/private-spin.c +build_sources_library-thread thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c build_sources_headers account.h account/accounts.h account/common.h build_sources_headers capability.h capability/common.h diff --git a/build/monolithic/settings b/build/monolithic/settings index 28fe3a3..be2a47c 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -77,7 +77,6 @@ build_sources_library level_0/string/static.c level_0/string/statics.c level_0/s build_sources_library level_0/string/triple.c level_0/string/triples.c level_0/string/tripless.c build_sources_library level_0/time.c build_sources_library level_0/type_array/cell.c level_0/type_array/file.c level_0/type_array/fll_id.c level_0/type_array/int8.c level_0/type_array/int16.c level_0/type_array/int32.c level_0/type_array/int64.c level_0/type_array/int128.c level_0/type_array/number_unsigned.c level_0/type_array/poll.c level_0/type_array/state.c level_0/type_array/status.c level_0/type_array/uint8.c level_0/type_array/uint16.c level_0/type_array/uint32.c level_0/type_array/uint64.c level_0/type_array/uint128.c -build_sources_library level_0/type_array/private-poll.c level_0/type_array/private-state.c level_0/type_array/private-status.c build_sources_library level_0/utf.c level_0/private-utf.c level_0/private-utf_alphabetic.c level_0/private-utf_combining.c level_0/private-utf_control.c level_0/private-utf_digit.c level_0/private-utf_emoji.c level_0/private-utf_numeric.c level_0/private-utf_phonetic.c level_0/private-utf_private.c level_0/private-utf_punctuation.c level_0/private-utf_subscript.c level_0/private-utf_superscript.c level_0/private-utf_symbol.c level_0/private-utf_unassigned.c level_0/private-utf_valid.c level_0/private-utf_whitespace.c level_0/private-utf_wide.c level_0/private-utf_word.c level_0/private-utf_zero_width.c build_sources_library level_0/utf/common.c level_0/utf/convert.c build_sources_library level_0/utf/dynamic.c level_0/utf/dynamics.c level_0/utf/dynamicss.c @@ -114,7 +113,7 @@ build_sources_library level_2/print.c build_sources_library level_2/program.c level_2/program/common.c level_2/program/print.c level_2/private-program.c build_sources_library-thread level_0/thread.c level_0/thread/attribute.c level_0/thread/barrier.c level_0/thread/barrier_attribute.c level_0/thread/condition.c level_0/thread/condition_attribute.c level_0/thread/id.c level_0/thread/key.c level_0/thread/lock.c level_0/thread/lock_attribute.c level_0/thread/mutex.c level_0/thread/mutex_attribute.c level_0/thread/once.c level_0/thread/semaphore.c level_0/thread/set.c level_0/thread/spin.c -build_sources_library-thread level_0/thread/private-attribute.c level_0/thread/private-barrier.c level_0/thread/private-barrier_attribute.c level_0/thread/private-condition.c level_0/thread/private-condition_attribute.c level_0/thread/private-id.c level_0/thread/private-key.c level_0/thread/private-lock.c level_0/thread/private-lock_attribute.c level_0/thread/private-mutex.c level_0/thread/private-mutex_attribute.c level_0/thread/private-once.c level_0/thread/private-semaphore.c level_0/thread/private-set.c level_0/thread/private-spin.c +build_sources_library-thread level_0/thread/private-barrier.c level_0/thread/private-barrier_attribute.c level_0/thread/private-condition.c level_0/thread/private-condition_attribute.c build_sources_headers level_0/account.h level_0/account/accounts.h level_0/account/common.h build_sources_headers level_0/capability.h level_0/capability/common.h diff --git a/build/stand_alone/byte_dump.settings b/build/stand_alone/byte_dump.settings index 94ad185..962ba91 100644 --- a/build/stand_alone/byte_dump.settings +++ b/build/stand_alone/byte_dump.settings @@ -32,8 +32,7 @@ build_sources_program fll/level_0/pipe.c build_sources_program fll/level_0/print.c fll/level_0/private-print.c fll/level_0/print/common.c fll/level_0/print/to.c fll/level_0/print/private-to.c build_sources_program fll/level_0/signal.c build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/dynamic.c fll/level_0/string/map.c fll/level_0/string/map_multi.c fll/level_0/string/private-map.c fll/level_0/string/private-map_multi.c fll/level_0/string/private-quantity.c fll/level_0/string/private-range.c fll/level_0/string/private-triple.c fll/level_0/string/quantity.c fll/level_0/string/range.c fll/level_0/string/static.c fll/level_0/string/triple.c -build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c -build_sources_program fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c +build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/file.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/poll.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/map_multi.c fll/level_0/utf/static.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-map.c fll/level_0/utf/private-map_multi.c fll/level_0/utf/private-triple.c fll/level_0/utf/private-string.c diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index c2ee651..3420196 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -56,14 +56,13 @@ build_sources_program fll/level_0/rip.c fll/level_0/rip/utf.c fll/level_0/privat build_sources_program fll/level_0/signal.c build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/private-dynamics.c fll/level_0/string/private-dynamicss.c fll/level_0/string/private-maps.c fll/level_0/string/private-mapss.c fll/level_0/string/private-map_multis.c fll/level_0/string/private-map_multiss.c fll/level_0/string/private-quantitys.c fll/level_0/string/private-quantityss.c fll/level_0/string/private-ranges.c fll/level_0/string/private-rangess.c fll/level_0/string/private-triples.c fll/level_0/string/private-tripless.c build_sources_program fll/level_0/string/dynamic.c fll/level_0/string/dynamics.c fll/level_0/string/dynamicss.c fll/level_0/string/map.c fll/level_0/string/maps.c fll/level_0/string/mapss.c fll/level_0/string/map_multi.c fll/level_0/string/map_multis.c fll/level_0/string/map_multiss.c fll/level_0/string/quantity.c fll/level_0/string/quantitys.c fll/level_0/string/quantityss.c fll/level_0/string/range.c fll/level_0/string/ranges.c fll/level_0/string/rangess.c fll/level_0/string/static.c fll/level_0/string/statics.c fll/level_0/string/staticss.c fll/level_0/string/triple.c fll/level_0/string/triples.c fll/level_0/string/tripless.c -build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c -build_sources_program fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c +build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/file.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/poll.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c build_sources_program fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-dynamicss.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-mapss.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-map_multiss.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c fll/level_0/utf/private-tripless.c build_sources_program-thread fll/level_0/thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c -build_sources_program-thread fll/level_0/thread/private-attribute.c fll/level_0/thread/private-barrier.c fll/level_0/thread/private-barrier_attribute.c fll/level_0/thread/private-condition.c fll/level_0/thread/private-condition_attribute.c fll/level_0/thread/private-id.c fll/level_0/thread/private-key.c fll/level_0/thread/private-lock.c fll/level_0/thread/private-lock_attribute.c fll/level_0/thread/private-mutex.c fll/level_0/thread/private-mutex_attribute.c fll/level_0/thread/private-once.c fll/level_0/thread/private-semaphore.c fll/level_0/thread/private-set.c fll/level_0/thread/private-spin.c +build_sources_program-thread fll/level_0/thread/private-barrier.c fll/level_0/thread/private-barrier_attribute.c fll/level_0/thread/private-condition.c fll/level_0/thread/private-condition_attribute.c build_sources_program fll/level_1/control_group.c build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c diff --git a/build/stand_alone/firewall.settings b/build/stand_alone/firewall.settings index d1f28a3..f3d1ab2 100644 --- a/build/stand_alone/firewall.settings +++ b/build/stand_alone/firewall.settings @@ -42,8 +42,7 @@ build_sources_program fll/level_0/print.c fll/level_0/private-print.c fll/level_ build_sources_program fll/level_0/signal.c build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/dynamic.c fll/level_0/string/map.c fll/level_0/string/map_multi.c fll/level_0/string/private-map.c fll/level_0/string/private-map_multi.c fll/level_0/string/private-quantity.c fll/level_0/string/private-range.c fll/level_0/string/private-triple.c fll/level_0/string/quantity.c fll/level_0/string/range.c fll/level_0/string/static.c fll/level_0/string/triple.c build_sources_program fll/level_0/thread.c fll/level_0/private-thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c -build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c -build_sources_program fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c +build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/file.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/poll.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/map_multi.c fll/level_0/utf/static.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-map.c fll/level_0/utf/private-map_multi.c fll/level_0/utf/private-triple.c fll/level_0/utf/private-string.c diff --git a/build/stand_alone/utf8.settings b/build/stand_alone/utf8.settings index a637575..ea2daa3 100644 --- a/build/stand_alone/utf8.settings +++ b/build/stand_alone/utf8.settings @@ -33,8 +33,7 @@ build_sources_program fll/level_0/print.c fll/level_0/private-print.c fll/level_ build_sources_program fll/level_0/signal.c build_sources_program fll/level_0/string.c fll/level_0/private-string.c fll/level_0/string/common.c fll/level_0/string/private-dynamics.c fll/level_0/string/private-dynamicss.c fll/level_0/string/private-maps.c fll/level_0/string/private-mapss.c fll/level_0/string/private-map_multis.c fll/level_0/string/private-map_multiss.c fll/level_0/string/private-quantitys.c fll/level_0/string/private-quantityss.c fll/level_0/string/private-ranges.c fll/level_0/string/private-rangess.c fll/level_0/string/private-triples.c fll/level_0/string/private-tripless.c build_sources_program fll/level_0/string/dynamic.c fll/level_0/string/dynamics.c fll/level_0/string/dynamicss.c fll/level_0/string/map.c fll/level_0/string/maps.c fll/level_0/string/mapss.c fll/level_0/string/map_multi.c fll/level_0/string/map_multis.c fll/level_0/string/map_multiss.c fll/level_0/string/quantity.c fll/level_0/string/quantitys.c fll/level_0/string/quantityss.c fll/level_0/string/range.c fll/level_0/string/ranges.c fll/level_0/string/rangess.c fll/level_0/string/static.c fll/level_0/string/statics.c fll/level_0/string/staticss.c fll/level_0/string/triple.c fll/level_0/string/triples.c fll/level_0/string/tripless.c -build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c -build_sources_program fll/level_0/type_array/private-state.c fll/level_0/type_array/private-status.c +build_sources_program fll/level_0/type_array/cell.c fll/level_0/type_array/file.c fll/level_0/type_array/fll_id.c fll/level_0/type_array/int8.c fll/level_0/type_array/int16.c fll/level_0/type_array/int32.c fll/level_0/type_array/int64.c fll/level_0/type_array/int128.c fll/level_0/type_array/number_unsigned.c fll/level_0/type_array/poll.c fll/level_0/type_array/state.c fll/level_0/type_array/status.c fll/level_0/type_array/uint8.c fll/level_0/type_array/uint16.c fll/level_0/type_array/uint32.c fll/level_0/type_array/uint64.c fll/level_0/type_array/uint128.c build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/private-utf_alphabetic.c fll/level_0/private-utf_combining.c fll/level_0/private-utf_control.c fll/level_0/private-utf_digit.c fll/level_0/private-utf_emoji.c fll/level_0/private-utf_numeric.c fll/level_0/private-utf_phonetic.c fll/level_0/private-utf_private.c fll/level_0/private-utf_punctuation.c fll/level_0/private-utf_subscript.c fll/level_0/private-utf_superscript.c fll/level_0/private-utf_symbol.c fll/level_0/private-utf_unassigned.c fll/level_0/private-utf_valid.c fll/level_0/private-utf_whitespace.c fll/level_0/private-utf_wide.c fll/level_0/private-utf_word.c fll/level_0/private-utf_zero_width.c build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/level_0/utf/dynamic.c fll/level_0/utf/dynamics.c fll/level_0/utf/dynamicss.c fll/level_0/utf/is.c fll/level_0/utf/is_character.c fll/level_0/utf/map.c fll/level_0/utf/maps.c fll/level_0/utf/mapss.c fll/level_0/utf/map_multi.c fll/level_0/utf/map_multis.c fll/level_0/utf/map_multiss.c fll/level_0/utf/static.c fll/level_0/utf/statics.c fll/level_0/utf/staticss.c fll/level_0/utf/string.c fll/level_0/utf/triple.c fll/level_0/utf/triples.c fll/level_0/utf/tripless.c build_sources_program fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-dynamicss.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-mapss.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-map_multiss.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c fll/level_0/utf/private-tripless.c diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index 12eee62..e64ebc3 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -1,15 +1,8 @@ #include "thread.h" -#include "thread/private-attribute.h" +#include "thread/private-barrier.h" #include "thread/private-barrier_attribute.h" #include "thread/private-condition.h" #include "thread/private-condition_attribute.h" -#include "thread/private-key.h" -#include "thread/private-lock.h" -#include "thread/private-lock_attribute.h" -#include "thread/private-mutex.h" -#include "thread/private-mutex_attribute.h" -#include "thread/private-semaphore.h" -#include "thread/private-spin.h" #ifdef __cplusplus extern "C" { @@ -177,7 +170,9 @@ extern "C" { if (!attribute) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_attribute_delete(attribute); + if (pthread_attr_destroy(attribute)) return F_status_set_error(F_failure); + + return F_none; } #endif // _di_f_thread_attribute_delete_ @@ -1030,12 +1025,16 @@ extern "C" { #endif // _di_f_thread_key_create_ #ifndef _di_f_thread_key_delete_ - f_status_t f_thread_key_delete(f_thread_key_t *key) { + f_status_t f_thread_key_delete(f_thread_key_t * const key) { #ifndef _di_level_0_parameter_checking_ if (!key) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_key_delete(key); + if (pthread_key_delete(*key)) return F_status_set_error(F_failure); + + *key = 0; + + return F_none; } #endif // _di_f_thread_key_delete_ @@ -1097,7 +1096,16 @@ extern "C" { if (!attribute) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_lock_attribute_delete(attribute); + const int error = pthread_rwlockattr_destroy(attribute); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + + return F_none; } #endif // _di_f_thread_lock_attribute_delete_ @@ -1159,7 +1167,18 @@ extern "C" { if (!lock) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_lock_delete(lock); + { + int error = pthread_rwlock_destroy(lock); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } + + return F_none; } #endif // _di_f_thread_lock_delete_ @@ -1314,7 +1333,18 @@ extern "C" { if (!attribute) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_mutex_attribute_delete(attribute); + { + const int error = pthread_mutexattr_destroy(attribute); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } + + return F_none; } #endif // _di_f_thread_mutex_attribute_delete_ @@ -1491,7 +1521,18 @@ extern "C" { if (!mutex) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_mutex_delete(mutex); + { + const int error = pthread_mutex_destroy(mutex); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } + + return F_none; } #endif // _di_f_thread_mutex_delete_ @@ -1720,7 +1761,9 @@ extern "C" { if (!semaphore) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_semaphore_delete(semaphore); + if (sem_destroy(semaphore) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + + return F_none; } #endif // _di_f_thread_semaphore_delete_ @@ -1967,7 +2010,16 @@ extern "C" { if (!spin) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_spin_delete(spin); + const int error = pthread_spin_destroy(spin); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + + return F_none; } #endif // _di_f_thread_spin_delete_ diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index c6c4fa1..b9d0f99 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -1355,7 +1355,7 @@ extern "C" { * @see pthread_key_delete() */ #ifndef _di_f_thread_key_delete_ - extern f_status_t f_thread_key_delete(f_thread_key_t *key); + extern f_status_t f_thread_key_delete(f_thread_key_t * const key); #endif // _di_f_thread_key_delete_ /** diff --git a/level_0/f_thread/c/thread/attribute.c b/level_0/f_thread/c/thread/attribute.c index b62418c..4a41d3d 100644 --- a/level_0/f_thread/c/thread/attribute.c +++ b/level_0/f_thread/c/thread/attribute.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-attribute.h" #include "attribute.h" #ifdef __cplusplus @@ -12,7 +11,11 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_attributes_adjust(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_attributes_adjust_ @@ -24,7 +27,13 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_attributes_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_attributes_decimate_by_ @@ -36,7 +45,13 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_attributes_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_attributes_decrease_by_ @@ -55,7 +70,11 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_attributes_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +95,11 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_attributes_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +113,11 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_attributes_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_attributes_resize_ diff --git a/level_0/f_thread/c/thread/id.c b/level_0/f_thread/c/thread/id.c index d37b005..9068235 100644 --- a/level_0/f_thread/c/thread/id.c +++ b/level_0/f_thread/c/thread/id.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-id.h" #include "id.h" #ifdef __cplusplus diff --git a/level_0/f_thread/c/thread/key.c b/level_0/f_thread/c/thread/key.c index 177b419..156501a 100644 --- a/level_0/f_thread/c/thread/key.c +++ b/level_0/f_thread/c/thread/key.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-key.h" #include "key.h" #ifdef __cplusplus @@ -12,7 +11,14 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_keys_adjust(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + if (pthread_key_delete(structure->array[i])) return F_status_set_error(F_failure); + + structure->array[i] = 0; + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_key_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_keys_adjust_ @@ -24,7 +30,16 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_keys_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + if (pthread_key_delete(structure->array[i])) return F_status_set_error(F_failure); + + structure->array[i] = 0; + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_key_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_keys_decimate_by_ @@ -36,7 +51,16 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_keys_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + if (pthread_key_delete(structure->array[i])) return F_status_set_error(F_failure); + + structure->array[i] = 0; + } // for + + return f_memory_array_resize(length, sizeof(f_thread_key_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_keys_decrease_by_ @@ -55,7 +79,14 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_keys_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + if (pthread_key_delete(structure->array[i])) return F_status_set_error(F_failure); + + structure->array[i] = 0; + } // for + + return f_memory_array_resize(length, sizeof(f_thread_key_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +107,14 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_keys_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + if (pthread_key_delete(structure->array[i])) return F_status_set_error(F_failure); + + structure->array[i] = 0; + } // for + + return f_memory_array_resize(length, sizeof(f_thread_key_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +128,14 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_keys_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + if (pthread_key_delete(structure->array[i])) return F_status_set_error(F_failure); + + structure->array[i] = 0; + } // for + + return f_memory_array_resize(length, sizeof(f_thread_key_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_keys_resize_ diff --git a/level_0/f_thread/c/thread/lock.c b/level_0/f_thread/c/thread/lock.c index 0bfd995..f0ba7bf 100644 --- a/level_0/f_thread/c/thread/lock.c +++ b/level_0/f_thread/c/thread/lock.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-lock.h" #include "lock.h" #ifdef __cplusplus @@ -12,7 +11,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_locks_adjust(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlock_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_lock_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_locks_adjust_ @@ -24,7 +39,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_locks_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlock_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_lock_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_locks_decimate_by_ @@ -36,7 +69,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_locks_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlock_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_lock_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_locks_decrease_by_ @@ -55,7 +106,23 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_locks_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlock_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_lock_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +143,23 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_locks_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlock_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_lock_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +173,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_locks_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlock_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_lock_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_locks_resize_ diff --git a/level_0/f_thread/c/thread/lock_attribute.c b/level_0/f_thread/c/thread/lock_attribute.c index 68d8b8b..9e9c7c3 100644 --- a/level_0/f_thread/c/thread/lock_attribute.c +++ b/level_0/f_thread/c/thread/lock_attribute.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-lock_attribute.h" #include "lock_attribute.h" #ifdef __cplusplus @@ -12,7 +11,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_lock_attributes_adjust(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlockattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_lock_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_lock_attributes_adjust_ @@ -24,7 +39,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_lock_attributes_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlockattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_lock_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_lock_attributes_decimate_by_ @@ -36,7 +69,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_lock_attributes_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlockattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_lock_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_lock_attributes_decrease_by_ @@ -55,7 +106,23 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_lock_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlockattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_lock_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +143,23 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_lock_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlockattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_lock_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +173,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_lock_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_rwlockattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_lock_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_lock_attributes_resize_ diff --git a/level_0/f_thread/c/thread/mutex.c b/level_0/f_thread/c/thread/mutex.c index 376cf61..bbf6fe5 100644 --- a/level_0/f_thread/c/thread/mutex.c +++ b/level_0/f_thread/c/thread/mutex.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-mutex.h" #include "mutex.h" #ifdef __cplusplus @@ -12,7 +11,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_mutexs_adjust(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutex_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_mutex_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_mutexs_adjust_ @@ -24,7 +39,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_mutexs_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutex_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_mutex_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_mutexs_decimate_by_ @@ -36,7 +69,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_mutexs_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutex_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_mutex_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_mutexs_decrease_by_ @@ -55,7 +106,23 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_mutexs_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutex_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_mutex_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +143,23 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_mutexs_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutex_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_mutex_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +173,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_mutexs_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutex_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_mutex_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_mutexs_resize_ diff --git a/level_0/f_thread/c/thread/mutex_attribute.c b/level_0/f_thread/c/thread/mutex_attribute.c index 4cc71ac..82257fd 100644 --- a/level_0/f_thread/c/thread/mutex_attribute.c +++ b/level_0/f_thread/c/thread/mutex_attribute.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-mutex_attribute.h" #include "mutex_attribute.h" #ifdef __cplusplus @@ -12,7 +11,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_mutex_attributes_adjust(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutexattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_mutex_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_mutex_attributes_adjust_ @@ -24,7 +39,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_mutex_attributes_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutexattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_mutex_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_mutex_attributes_decimate_by_ @@ -36,7 +69,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_mutex_attributes_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutexattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_mutex_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_mutex_attributes_decrease_by_ @@ -55,7 +106,23 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_mutex_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutexattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_mutex_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +143,23 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_mutex_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutexattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_mutex_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +173,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_mutex_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_mutexattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_mutex_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_mutex_attributes_resize_ diff --git a/level_0/f_thread/c/thread/once.c b/level_0/f_thread/c/thread/once.c index f7a7514..6f98338 100644 --- a/level_0/f_thread/c/thread/once.c +++ b/level_0/f_thread/c/thread/once.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-once.h" #include "once.h" #ifdef __cplusplus diff --git a/level_0/f_thread/c/thread/private-attribute.c b/level_0/f_thread/c/thread/private-attribute.c deleted file mode 100644 index 40425bb..0000000 --- a/level_0/f_thread/c/thread/private-attribute.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "../thread.h" -#include "private-attribute.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_attributes_adjust_) || !defined(_di_f_thread_attributes_decimate_by_) || !defined(_di_f_thread_attributes_decrease_) || !defined(_di_f_thread_attributes_decrease_by_) || !defined(_di_f_thread_attributes_increase_) || !defined(_di_f_thread_attributes_increase_by_) || !defined(_di_f_thread_attributes_resize_) || !defined(_di_f_thread_sets_adjust_) || !defined(_di_f_thread_sets_decimate_by_) || !defined(_di_f_thread_sets_decrease_) || !defined(_di_f_thread_sets_decrease_by_) || !defined(_di_f_thread_sets_increase_) || !defined(_di_f_thread_sets_increase_by_) || !defined(_di_f_thread_sets_resize_) - f_status_t private_f_thread_attribute_delete(f_thread_attribute_t *structure) { - - if (pthread_attr_destroy(structure)) return F_status_set_error(F_failure); - - return F_none; - } -#endif // !defined(_di_f_thread_attributes_adjust_) || !defined(_di_f_thread_attributes_decimate_by_) || !defined(_di_f_thread_attributes_decrease_) || !defined(_di_f_thread_attributes_decrease_by_) || !defined(_di_f_thread_attributes_increase_) || !defined(_di_f_thread_attributes_increase_by_) || !defined(_di_f_thread_attributes_resize_) || !defined(_di_f_thread_sets_adjust_) || !defined(_di_f_thread_sets_decimate_by_) || !defined(_di_f_thread_sets_decrease_) || !defined(_di_f_thread_sets_decrease_by_) || !defined(_di_f_thread_sets_increase_) || !defined(_di_f_thread_sets_increase_by_) || !defined(_di_f_thread_sets_resize_) - -#if !defined(_di_f_thread_attributes_adjust_) || !defined(_di_f_thread_attributes_decimate_by_) - f_status_t private_f_thread_attributes_adjust(const f_number_unsigned_t length, f_thread_attributes_t * const attributes) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < attributes->size; ++i) { - - status = private_f_thread_attribute_delete(&attributes->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->size); - } -#endif // !defined(_di_f_thread_attributes_adjust_) || !defined(_di_f_thread_attributes_decimate_by_) - -#if !defined(_di_f_thread_attributes_decrease_) || !defined(_di_f_thread_attributes_decrease_by_) || !defined(_di_f_thread_attributes_increase_) || !defined(_di_f_thread_attributes_increase_by_) - f_status_t private_f_thread_attributes_resize(const f_number_unsigned_t length, f_thread_attributes_t * const attributes) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < attributes->size; ++i) { - - status = private_f_thread_attribute_delete(&attributes->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->size); - } -#endif // !defined(_di_f_thread_attributes_decrease_) || !defined(_di_f_thread_attributes_decrease_by_) || !defined(_di_f_thread_attributes_increase_) || !defined(_di_f_thread_attributes_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-attribute.h b/level_0/f_thread/c/thread/private-attribute.h deleted file mode 100644 index 195cd6f..0000000 --- a/level_0/f_thread/c/thread/private-attribute.h +++ /dev/null @@ -1,342 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_attribute_h -#define _PRIVATE_F_thread_attribute_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The thread attribute to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_attr_destroy() - * - * @see f_thread_attributes_adjust() - * @see f_thread_attributes_decimate_by() - * @see f_thread_attributes_decrease() - * @see f_thread_attributes_decrease_by() - * @see f_thread_attributes_increase() - * @see f_thread_attributes_increase_by() - * @see f_thread_attributes_resize() - * @see f_thread_sets_adjust() - * @see f_thread_sets_decimate_by() - * @see f_thread_sets_decrease() - * @see f_thread_sets_decrease_by() - * @see f_thread_sets_increase() - * @see f_thread_sets_increase_by() - * @see f_thread_sets_resize() - */ -#if !defined(_di_f_thread_attributes_adjust_) || !defined(_di_f_thread_attributes_decimate_by_) || !defined(_di_f_thread_attributes_decrease_) || !defined(_di_f_thread_attributes_decrease_by_) || !defined(_di_f_thread_attributes_increase_) || !defined(_di_f_thread_attributes_increase_by_) || !defined(_di_f_thread_attributes_resize_) || !defined(_di_f_thread_sets_adjust_) || !defined(_di_f_thread_sets_decimate_by_) || !defined(_di_f_thread_sets_decrease_) || !defined(_di_f_thread_sets_decrease_by_) || !defined(_di_f_thread_sets_increase_) || !defined(_di_f_thread_sets_increase_by_) || !defined(_di_f_thread_sets_resize_) - extern f_status_t private_f_thread_attribute_delete(f_thread_attribute_t *structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_attributes_adjust_) || !defined(_di_f_thread_attributes_decimate_by_) || !defined(_di_f_thread_attributes_decrease_) || !defined(_di_f_thread_attributes_decrease_by_) || !defined(_di_f_thread_attributes_increase_) || !defined(_di_f_thread_attributes_increase_by_) || !defined(_di_f_thread_sets_adjust_) || !defined(_di_f_thread_sets_decimate_by_) || !defined(_di_f_thread_sets_decrease_) || !defined(_di_f_thread_sets_decrease_by_) || !defined(_di_f_thread_sets_increase_) || !defined(_di_f_thread_sets_increase_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param attributes - * The attributes to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_adjust(). - * - * @see f_memory_adjust() - * @see f_thread_attributes_adjust() - * @see f_thread_attributes_decimate_by() - */ -#if !defined(_di_f_thread_attributes_adjust_) || !defined(_di_f_thread_attributes_decimate_by_) - extern f_status_t private_f_thread_attributes_adjust(const f_number_unsigned_t length, f_thread_attributes_t * const attributes) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_attributes_adjust_) || !defined(_di_f_thread_attributes_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param attributes - * The attributes to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * - * @see f_memory_resize() - * @see f_thread_attributes_decrease_by() - * @see f_thread_attributes_increase() - * @see f_thread_attributes_increase_by() - */ -#if !defined(_di_f_thread_attributes_decrease_by_) || !defined(_di_f_thread_attributes_increase_) || !defined(_di_f_thread_attributes_increase_by_) - extern f_status_t private_f_thread_attributes_resize(const f_number_unsigned_t length, f_thread_attributes_t * const attributes) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_attributes_decrease_by_) || !defined(_di_f_thread_attributes_increase_) || !defined(_di_f_thread_attributes_increase_by_) - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param barriers - * The barriers to adjust. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_attr_destroy() - * - * @see f_thread_barriers_adjust() - * @see f_thread_barriers_decimate_by() - * @see f_thread_barriers_decrease() - * @see f_thread_barriers_decrease_by() - * @see f_thread_barriers_increase() - * @see f_thread_barriers_increase_by() - * @see f_thread_barriers_resize() - */ -#if !defined(_di_f_thread_barriers_adjust_) || !defined(_di_f_thread_barriers_decimate_by_) || !defined(_di_f_thread_barriers_decrease_) || !defined(_di_f_thread_barriers_decrease_by_) || !defined(_di_f_thread_barriers_increase_) || !defined(_di_f_thread_barriers_increase_by_) || !defined(_di_f_thread_barriers_resize_) - extern f_status_t private_f_thread_barrier_delete(f_thread_barrier_t *barrier) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_barriers_adjust_) || !defined(_di_f_thread_barriers_decimate_by_) || !defined(_di_f_thread_barriers_decrease_) || !defined(_di_f_thread_barriers_decrease_by_) || !defined(_di_f_thread_barriers_increase_) || !defined(_di_f_thread_barriers_increase_by_) || !defined(_di_f_thread_barriers_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param barriers - * The barriers to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - * - * @see f_thread_barriers_adjust() - * @see f_thread_barriers_decimate_by() - */ -#if !defined(_di_f_thread_barriers_adjust_) || !defined(_di_f_thread_barriers_decimate_by_) - extern f_status_t private_f_thread_barriers_adjust(const f_number_unsigned_t length, f_thread_barriers_t * const barriers) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_barriers_adjust_) || !defined(_di_f_thread_barriers_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param barriers - * The barriers to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * - * @see f_memory_resize() - * @see f_thread_barriers_decrease_by() - * @see f_thread_barriers_increase() - * @see f_thread_barriers_increase_by() - */ -#if !defined(_di_f_thread_barriers_decrease_by_) || !defined(_di_f_thread_barriers_increase_) || !defined(_di_f_thread_barriers_increase_by_) - extern f_status_t private_f_thread_barriers_resize(const f_number_unsigned_t length, f_thread_barriers_t * const barriers) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_barriers_decrease_by_) || !defined(_di_f_thread_barriers_increase_) || !defined(_di_f_thread_barriers_increase_by_) - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param attributes - * The attributes to adjust. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_attr_destroy() - * - * @see f_thread_barrier_attributes_adjust() - * @see f_thread_barrier_attributes_decimate_by() - * @see f_thread_barrier_attributes_decrease() - * @see f_thread_barrier_attributes_decrease_by() - * @see f_thread_barrier_attributes_increase() - * @see f_thread_barrier_attributes_increase_by() - * @see f_thread_barrier_attributes_resize() - */ -#if !defined(_di_f_thread_barrier_attributes_adjust_) || !defined(_di_f_thread_barrier_attributes_decimate_by_) || !defined(_di_f_thread_barrier_attributes_decrease_) || !defined(_di_f_thread_barrier_attributes_decrease_by_) || !defined(_di_f_thread_barrier_attributes_increase_) || !defined(_di_f_thread_barrier_attributes_increase_by_) || !defined(_di_f_thread_barrier_attributes_resize_) - extern f_status_t private_f_thread_barrier_attribute_delete(f_thread_barrier_attribute_t *attribute) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_barrier_attributes_adjust_) || !defined(_di_f_thread_barrier_attributes_decimate_by_) || !defined(_di_f_thread_barrier_attributes_decrease_) || !defined(_di_f_thread_barrier_attributes_decrease_by_) || !defined(_di_f_thread_barrier_attributes_increase_) || !defined(_di_f_thread_barrier_attributes_increase_by_) || !defined(_di_f_thread_barrier_attributes_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param attributes - * The attributes to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_adjust(). - * - * @see f_memory_adjust() - * @see f_thread_barrier_attributes_adjust() - * @see f_thread_barrier_attributes_decimate_by() - */ -#if !defined(_di_f_thread_barrier_attributes_adjust_) || !defined(_di_f_thread_barrier_attributes_decimate_by_) - extern f_status_t private_f_thread_barrier_attributes_adjust(const f_number_unsigned_t length, f_thread_barrier_attributes_t * const attributes) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_barrier_attributes_adjust_) || !defined(_di_f_thread_barrier_attributes_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param attributes - * The attributes to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * - * @see f_memory_resize() - * @see f_thread_barrier_attributes_decrease_by() - * @see f_thread_barrier_attributes_increase() - * @see f_thread_barrier_attributes_increase_by() - */ -#if !defined(_di_f_thread_barrier_attributes_decrease_by_) || !defined(_di_f_thread_barrier_attributes_increase_) || !defined(_di_f_thread_barrier_attributes_increase_by_) - extern f_status_t private_f_thread_barrier_attributes_resize(const f_number_unsigned_t length, f_thread_barrier_attributes_t * const attributes) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_barrier_attributes_decrease_by_) || !defined(_di_f_thread_barrier_attributes_increase_) || !defined(_di_f_thread_barrier_attributes_increase_by_) - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param attribute - * The attribute to adjust. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_condattr_destroy() - * - * @see f_thread_condition_attributes_adjust() - * @see f_thread_condition_attributes_decimate_by() - * @see f_thread_condition_attributes_decrease() - * @see f_thread_condition_attributes_decrease_by() - * @see f_thread_condition_attributes_increase() - * @see f_thread_condition_attributes_increase_by() - * @see f_thread_condition_attributes_resize() - */ -#if !defined(_di_f_thread_condition_attributes_adjust_) || !defined(_di_f_thread_condition_attributes_decimate_by_) || !defined(_di_f_thread_condition_attributes_decrease_) || !defined(_di_f_thread_condition_attributes_decrease_by_) || !defined(_di_f_thread_condition_attributes_increase_) || !defined(_di_f_thread_condition_attributes_increase_by_) || !defined(_di_f_thread_condition_attributes_resize_) - extern f_status_t private_f_thread_condition_attribute_delete(f_thread_condition_attribute_t *attribute) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_condition_attributes_adjust_) || !defined(_di_f_thread_condition_attributes_decimate_by_) || !defined(_di_f_thread_condition_attributes_decrease_) || !defined(_di_f_thread_condition_attributes_decrease_by_) || !defined(_di_f_thread_condition_attributes_increase_) || !defined(_di_f_thread_condition_attributes_increase_by_) || !defined(_di_f_thread_condition_attributes_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param attributes - * The attributes to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_adjust(). - * - * @see f_memory_adjust() - * @see f_thread_condition_attributes_adjust() - * @see f_thread_condition_attributes_decimate_by() - */ -#if !defined(_di_f_thread_condition_attributes_adjust_) || !defined(_di_f_thread_condition_attributes_decimate_by_) - extern f_status_t private_f_thread_condition_attributes_adjust(const f_number_unsigned_t length, f_thread_condition_attributes_t * const attributes) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_condition_attributes_adjust_) || !defined(_di_f_thread_condition_attributes_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param attributes - * The attributes to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_resize(). - * - * @see f_memory_resize() - * @see f_thread_condition_attributes_decrease_by() - * @see f_thread_condition_attributes_increase() - * @see f_thread_condition_attributes_increase_by() - */ -#if !defined(_di_f_thread_condition_attributes_decrease_by_) || !defined(_di_f_thread_condition_attributes_increase_) || !defined(_di_f_thread_condition_attributes_increase_by_) - extern f_status_t private_f_thread_condition_attributes_resize(const f_number_unsigned_t length, f_thread_condition_attributes_t * const attributes) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_condition_attributes_decrease_by_) || !defined(_di_f_thread_condition_attributes_increase_) || !defined(_di_f_thread_condition_attributes_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_attribute_h diff --git a/level_0/f_thread/c/thread/private-id.c b/level_0/f_thread/c/thread/private-id.c deleted file mode 100644 index b96ca12..0000000 --- a/level_0/f_thread/c/thread/private-id.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "../thread.h" -#include "private-id.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-id.h b/level_0/f_thread/c/thread/private-id.h deleted file mode 100644 index 22fa219..0000000 --- a/level_0/f_thread/c/thread/private-id.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_id_h -#define _PRIVATE_F_thread_id_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_id_h diff --git a/level_0/f_thread/c/thread/private-key.c b/level_0/f_thread/c/thread/private-key.c deleted file mode 100644 index c4e3731..0000000 --- a/level_0/f_thread/c/thread/private-key.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "../thread.h" -#include "private-key.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_keys_adjust_) || !defined(_di_f_thread_keys_decimate_by_) || !defined(_di_f_thread_keys_decrease_) || !defined(_di_f_thread_keys_decrease_by_) || !defined(_di_f_thread_keys_increase_) || !defined(_di_f_thread_keys_increase_by_) || !defined(_di_f_thread_keys_resize_) - f_status_t private_f_thread_key_delete(f_thread_key_t *structure) { - - if (pthread_key_delete(*structure)) return F_status_set_error(F_failure); - - *structure = 0; - - return F_none; - } -#endif // !defined(_di_f_thread_keys_adjust_) || !defined(_di_f_thread_keys_decimate_by_) || !defined(_di_f_thread_keys_decrease_) || !defined(_di_f_thread_keys_decrease_by_) || !defined(_di_f_thread_keys_increase_) || !defined(_di_f_thread_keys_increase_by_) || !defined(_di_f_thread_keys_resize_) - -#if !defined(_di_f_thread_keys_adjust_) || !defined(_di_f_thread_keys_decimate_by_) - f_status_t private_f_thread_keys_adjust(const f_number_unsigned_t length, f_thread_keys_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_key_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_key_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_keys_adjust_) || !defined(_di_f_thread_keys_decimate_by_) - -#if !defined(_di_f_thread_keys_decrease_) || !defined(_di_f_thread_keys_decrease_by_) || !defined(_di_f_thread_keys_increase_) || !defined(_di_f_thread_keys_increase_by_) - f_status_t private_f_thread_keys_resize(const f_number_unsigned_t length, f_thread_keys_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_key_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_key_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_keys_decrease_) || !defined(_di_f_thread_keys_decrease_by_) || !defined(_di_f_thread_keys_increase_) || !defined(_di_f_thread_keys_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-key.h b/level_0/f_thread/c/thread/private-key.h deleted file mode 100644 index 8345e1e..0000000 --- a/level_0/f_thread/c/thread/private-key.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_key_h -#define _PRIVATE_F_thread_key_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param structure - * The key to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_key_destroy() - * - * @see f_thread_keys_adjust() - * @see f_thread_keys_decimate_by() - * @see f_thread_keys_decrease() - * @see f_thread_keys_decrease_by() - * @see f_thread_keys_increase() - * @see f_thread_keys_increase_by() - * @see f_thread_keys_resize() - */ -#if !defined(_di_f_thread_keys_adjust_) || !defined(_di_f_thread_keys_decimate_by_) || !defined(_di_f_thread_keys_decrease_) || !defined(_di_f_thread_keys_decrease_by_) || !defined(_di_f_thread_keys_increase_) || !defined(_di_f_thread_keys_increase_by_) || !defined(_di_f_thread_keys_resize_) - extern f_status_t private_f_thread_key_delete(f_thread_key_t *structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_keys_adjust_) || !defined(_di_f_thread_keys_decimate_by_) || !defined(_di_f_thread_keys_decrease_) || !defined(_di_f_thread_keys_decrease_by_) || !defined(_di_f_thread_keys_increase_) || !defined(_di_f_thread_keys_increase_by_) || !defined(_di_f_thread_keys_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The keys to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_keys_adjust() - * @see f_thread_keys_decimate_by() - */ -#if !defined(_di_f_thread_keys_adjust_) || !defined(_di_f_thread_keys_decimate_by_) - extern f_status_t private_f_thread_keys_adjust(const f_number_unsigned_t length, f_thread_keys_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_keys_adjust_) || !defined(_di_f_thread_keys_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The keys to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_keys_decrease_by() - * @see f_thread_keys_increase() - * @see f_thread_keys_increase_by() - */ -#if !defined(_di_f_thread_keys_decrease_by_) || !defined(_di_f_thread_keys_increase_) || !defined(_di_f_thread_keys_increase_by_) - extern f_status_t private_f_thread_keys_resize(const f_number_unsigned_t length, f_thread_keys_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_keys_decrease_by_) || !defined(_di_f_thread_keys_increase_) || !defined(_di_f_thread_keys_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_key_h diff --git a/level_0/f_thread/c/thread/private-lock.c b/level_0/f_thread/c/thread/private-lock.c deleted file mode 100644 index ca9950d..0000000 --- a/level_0/f_thread/c/thread/private-lock.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "../thread.h" -#include "private-lock.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_lock_delete_) || !defined(_di_f_thread_locks_adjust_) || !defined(_di_f_thread_locks_decimate_by_) || !defined(_di_f_thread_locks_decrease_) || !defined(_di_f_thread_locks_decrease_by_) || !defined(_di_f_thread_locks_increase_) || !defined(_di_f_thread_locks_increase_by_) || !defined(_di_f_thread_locks_resize_) - f_status_t private_f_thread_lock_delete(f_thread_lock_t *structure) { - - const int error = pthread_rwlock_destroy(structure); - - if (error) { - if (error == EBUSY) return F_status_set_error(F_busy); - if (error == EINVAL) return F_status_set_error(F_parameter); - - return F_status_set_error(F_failure); - } - - return F_none; - } -#endif // !defined(_di_f_thread_lock_delete_) || !defined(_di_f_thread_locks_adjust_) || !defined(_di_f_thread_locks_decimate_by_) || !defined(_di_f_thread_locks_decrease_) || !defined(_di_f_thread_locks_decrease_by_) || !defined(_di_f_thread_locks_increase_) || !defined(_di_f_thread_locks_increase_by_) || !defined(_di_f_thread_locks_resize_) - -#if !defined(_di_f_thread_locks_adjust_) || !defined(_di_f_thread_locks_decimate_by_) - f_status_t private_f_thread_locks_adjust(const f_number_unsigned_t length, f_thread_locks_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_lock_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_lock_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_locks_adjust_) || !defined(_di_f_thread_locks_decimate_by_) - -#if !defined(_di_f_thread_locks_decrease_) || !defined(_di_f_thread_locks_decrease_by_) || !defined(_di_f_thread_locks_increase_) || !defined(_di_f_thread_locks_increase_by_) - f_status_t private_f_thread_locks_resize(const f_number_unsigned_t length, f_thread_locks_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_lock_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_lock_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_locks_decrease_) || !defined(_di_f_thread_locks_decrease_by_) || !defined(_di_f_thread_locks_increase_) || !defined(_di_f_thread_locks_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-lock.h b/level_0/f_thread/c/thread/private-lock.h deleted file mode 100644 index 687dbb4..0000000 --- a/level_0/f_thread/c/thread/private-lock.h +++ /dev/null @@ -1,101 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_lock_h -#define _PRIVATE_F_thread_lock_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param structure - * The lock to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_rwlock_destroy() - * - * @see f_thread_lock_delete() - * @see f_thread_locks_adjust() - * @see f_thread_locks_decimate_by() - * @see f_thread_locks_decrease() - * @see f_thread_locks_decrease_by() - * @see f_thread_locks_increase() - * @see f_thread_locks_increase_by() - * @see f_thread_locks_resize() - */ -#if !defined(_di_f_thread_lock_delete_) || !defined(_di_f_thread_locks_adjust_) || !defined(_di_f_thread_locks_decimate_by_) || !defined(_di_f_thread_locks_decrease_) || !defined(_di_f_thread_locks_decrease_by_) || !defined(_di_f_thread_locks_increase_) || !defined(_di_f_thread_locks_increase_by_) || !defined(_di_f_thread_locks_resize_) - extern f_status_t private_f_thread_lock_delete(f_thread_lock_t *structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_lock_delete_) || !defined(_di_f_thread_locks_adjust_) || !defined(_di_f_thread_locks_decimate_by_) || !defined(_di_f_thread_locks_decrease_) || !defined(_di_f_thread_locks_decrease_by_) || !defined(_di_f_thread_locks_increase_) || !defined(_di_f_thread_locks_increase_by_) || !defined(_di_f_thread_locks_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The locks to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_locks_adjust() - * @see f_thread_locks_decimate_by() - */ -#if !defined(_di_f_thread_locks_adjust_) || !defined(_di_f_thread_locks_decimate_by_) - extern f_status_t private_f_thread_locks_adjust(const f_number_unsigned_t length, f_thread_locks_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_locks_adjust_) || !defined(_di_f_thread_locks_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The locks to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_locks_decrease_by() - * @see f_thread_locks_increase() - * @see f_thread_locks_increase_by() - */ -#if !defined(_di_f_thread_locks_decrease_by_) || !defined(_di_f_thread_locks_increase_) || !defined(_di_f_thread_locks_increase_by_) - extern f_status_t private_f_thread_locks_resize(const f_number_unsigned_t length, f_thread_locks_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_locks_decrease_by_) || !defined(_di_f_thread_locks_increase_) || !defined(_di_f_thread_locks_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_lock_h diff --git a/level_0/f_thread/c/thread/private-lock_attribute.c b/level_0/f_thread/c/thread/private-lock_attribute.c deleted file mode 100644 index 14a2615..0000000 --- a/level_0/f_thread/c/thread/private-lock_attribute.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "../thread.h" -#include "private-lock_attribute.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_lock_attributes_adjust_) || !defined(_di_f_thread_lock_attributes_decimate_by_) || !defined(_di_f_thread_lock_attributes_decrease_) || !defined(_di_f_thread_lock_attributes_decrease_by_) || !defined(_di_f_thread_lock_attributes_increase_) || !defined(_di_f_thread_lock_attributes_increase_by_) || !defined(_di_f_thread_lock_attributes_resize_) - f_status_t private_f_thread_lock_attribute_delete(f_thread_lock_attribute_t *structure) { - - const int error = pthread_rwlockattr_destroy(structure); - - if (error) { - if (error == EBUSY) return F_status_set_error(F_busy); - if (error == EINVAL) return F_status_set_error(F_parameter); - - return F_status_set_error(F_failure); - } - - return F_none; - } -#endif // !defined(_di_f_thread_lock_attributes_adjust_) || !defined(_di_f_thread_lock_attributes_decimate_by_) || !defined(_di_f_thread_lock_attributes_decrease_) || !defined(_di_f_thread_lock_attributes_decrease_by_) || !defined(_di_f_thread_lock_attributes_increase_) || !defined(_di_f_thread_lock_attributes_increase_by_) || !defined(_di_f_thread_lock_attributes_resize_) - -#if !defined(_di_f_thread_lock_attributes_adjust_) || !defined(_di_f_thread_lock_attributes_decimate_by_) - f_status_t private_f_thread_lock_attributes_adjust(const f_number_unsigned_t length, f_thread_lock_attributes_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_lock_attribute_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_lock_attribute_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_lock_attributes_adjust_) || !defined(_di_f_thread_lock_attributes_decimate_by_) - -#if !defined(_di_f_thread_lock_attributes_decrease_) || !defined(_di_f_thread_lock_attributes_decrease_by_) || !defined(_di_f_thread_lock_attributes_increase_) || !defined(_di_f_thread_lock_attributes_increase_by_) - f_status_t private_f_thread_lock_attributes_resize(const f_number_unsigned_t length, f_thread_lock_attributes_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_lock_attribute_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_lock_attribute_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_lock_attributes_decrease_) || !defined(_di_f_thread_lock_attributes_decrease_by_) || !defined(_di_f_thread_lock_attributes_increase_) || !defined(_di_f_thread_lock_attributes_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-lock_attribute.h b/level_0/f_thread/c/thread/private-lock_attribute.h deleted file mode 100644 index d0419ee..0000000 --- a/level_0/f_thread/c/thread/private-lock_attribute.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_lock_attribute_h -#define _PRIVATE_F_thread_lock_attribute_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param structure - * The attribute to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_rwlockattr_destroy() - * - * @see f_thread_lock_attributes_adjust() - * @see f_thread_lock_attributes_decimate_by() - * @see f_thread_lock_attributes_decrease() - * @see f_thread_lock_attributes_decrease_by() - * @see f_thread_lock_attributes_increase() - * @see f_thread_lock_attributes_increase_by() - * @see f_thread_lock_attributes_resize() - */ -#if !defined(_di_f_thread_lock_attributes_adjust_) || !defined(_di_f_thread_lock_attributes_decimate_by_) || !defined(_di_f_thread_lock_attributes_decrease_) || !defined(_di_f_thread_lock_attributes_decrease_by_) || !defined(_di_f_thread_lock_attributes_increase_) || !defined(_di_f_thread_lock_attributes_increase_by_) || !defined(_di_f_thread_lock_attributes_resize_) - extern f_status_t private_f_thread_lock_attribute_delete(f_thread_lock_attribute_t *structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_lock_attributes_adjust_) || !defined(_di_f_thread_lock_attributes_decimate_by_) || !defined(_di_f_thread_lock_attributes_decrease_) || !defined(_di_f_thread_lock_attributes_decrease_by_) || !defined(_di_f_thread_lock_attributes_increase_) || !defined(_di_f_thread_lock_attributes_increase_by_) || !defined(_di_f_thread_lock_attributes_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The lock_attributes to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_lock_attributes_adjust() - * @see f_thread_lock_attributes_decimate_by() - */ -#if !defined(_di_f_thread_lock_attributes_adjust_) || !defined(_di_f_thread_lock_attributes_decimate_by_) - extern f_status_t private_f_thread_lock_attributes_adjust(const f_number_unsigned_t length, f_thread_lock_attributes_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_lock_attributes_adjust_) || !defined(_di_f_thread_lock_attributes_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The lock_attributes to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_lock_attributes_decrease_by() - * @see f_thread_lock_attributes_increase() - * @see f_thread_lock_attributes_increase_by() - */ -#if !defined(_di_f_thread_lock_attributes_decrease_by_) || !defined(_di_f_thread_lock_attributes_increase_) || !defined(_di_f_thread_lock_attributes_increase_by_) - extern f_status_t private_f_thread_lock_attributes_resize(const f_number_unsigned_t length, f_thread_lock_attributes_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_lock_attributes_decrease_by_) || !defined(_di_f_thread_lock_attributes_increase_) || !defined(_di_f_thread_lock_attributes_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_lock_attribute_h diff --git a/level_0/f_thread/c/thread/private-mutex.c b/level_0/f_thread/c/thread/private-mutex.c deleted file mode 100644 index 6a0135b..0000000 --- a/level_0/f_thread/c/thread/private-mutex.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "../thread.h" -#include "private-mutex.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_mutex_delete_) || !defined(_di_f_thread_mutexs_adjust_) || !defined(_di_f_thread_mutexs_decimate_by_) || !defined(_di_f_thread_mutexs_decrease_) || !defined(_di_f_thread_mutexs_decrease_by_) || !defined(_di_f_thread_mutexs_increase_) || !defined(_di_f_thread_mutexs_increase_by_) || !defined(_di_f_thread_mutexs_resize_) - f_status_t private_f_thread_mutex_delete(f_thread_mutex_t *structure) { - - const int error = pthread_mutex_destroy(structure); - - if (error) { - if (error == EBUSY) return F_status_set_error(F_busy); - if (error == EINVAL) return F_status_set_error(F_parameter); - - return F_status_set_error(F_failure); - } - - return F_none; - } -#endif // !defined(_di_f_thread_mutex_delete_) || !defined(_di_f_thread_mutexs_adjust_) || !defined(_di_f_thread_mutexs_decimate_by_) || !defined(_di_f_thread_mutexs_decrease_) || !defined(_di_f_thread_mutexs_decrease_by_) || !defined(_di_f_thread_mutexs_increase_) || !defined(_di_f_thread_mutexs_increase_by_) || !defined(_di_f_thread_mutexs_resize_) - -#if !defined(_di_f_thread_mutexs_adjust_) || !defined(_di_f_thread_mutexs_decimate_by_) - f_status_t private_f_thread_mutexs_adjust(const f_number_unsigned_t length, f_thread_mutexs_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_mutex_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_mutex_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_mutexs_adjust_) || !defined(_di_f_thread_mutexs_decimate_by_) - -#if !defined(_di_f_thread_mutexs_decrease_) || !defined(_di_f_thread_mutexs_decrease_by_) || !defined(_di_f_thread_mutexs_increase_) || !defined(_di_f_thread_mutexs_increase_by_) - f_status_t private_f_thread_mutexs_resize(const f_number_unsigned_t length, f_thread_mutexs_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_mutex_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_mutex_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_mutexs_decrease_) || !defined(_di_f_thread_mutexs_decrease_by_) || !defined(_di_f_thread_mutexs_increase_) || !defined(_di_f_thread_mutexs_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-mutex.h b/level_0/f_thread/c/thread/private-mutex.h deleted file mode 100644 index 908ca39..0000000 --- a/level_0/f_thread/c/thread/private-mutex.h +++ /dev/null @@ -1,101 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_mutex_h -#define _PRIVATE_F_thread_mutex_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param structure - * The mutex to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_mutex_destroy() - * - * @see f_thread_mutex_delete() - * @see f_thread_mutexs_adjust() - * @see f_thread_mutexs_decimate_by() - * @see f_thread_mutexs_decrease() - * @see f_thread_mutexs_decrease_by() - * @see f_thread_mutexs_increase() - * @see f_thread_mutexs_increase_by() - * @see f_thread_mutexs_resize() - */ -#if !defined(_di_f_thread_mutex_delete_) || !defined(_di_f_thread_mutexs_adjust_) || !defined(_di_f_thread_mutexs_decimate_by_) || !defined(_di_f_thread_mutexs_decrease_) || !defined(_di_f_thread_mutexs_decrease_by_) || !defined(_di_f_thread_mutexs_increase_) || !defined(_di_f_thread_mutexs_increase_by_) || !defined(_di_f_thread_mutexs_resize_) - extern f_status_t private_f_thread_mutex_delete(f_thread_mutex_t *structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_mutex_delete_) || !defined(_di_f_thread_mutexs_adjust_) || !defined(_di_f_thread_mutexs_decimate_by_) || !defined(_di_f_thread_mutexs_decrease_) || !defined(_di_f_thread_mutexs_decrease_by_) || !defined(_di_f_thread_mutexs_increase_) || !defined(_di_f_thread_mutexs_increase_by_) || !defined(_di_f_thread_mutexs_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The mutexs to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_mutexs_adjust() - * @see f_thread_mutexs_decimate_by() - */ -#if !defined(_di_f_thread_mutexs_adjust_) || !defined(_di_f_thread_mutexs_decimate_by_) - extern f_status_t private_f_thread_mutexs_adjust(const f_number_unsigned_t length, f_thread_mutexs_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_mutexs_adjust_) || !defined(_di_f_thread_mutexs_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The mutexs to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_mutexs_decrease_by() - * @see f_thread_mutexs_increase() - * @see f_thread_mutexs_increase_by() - */ -#if !defined(_di_f_thread_mutexs_decrease_by_) || !defined(_di_f_thread_mutexs_increase_) || !defined(_di_f_thread_mutexs_increase_by_) - extern f_status_t private_f_thread_mutexs_resize(const f_number_unsigned_t length, f_thread_mutexs_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_mutexs_decrease_by_) || !defined(_di_f_thread_mutexs_increase_) || !defined(_di_f_thread_mutexs_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_mutex_h diff --git a/level_0/f_thread/c/thread/private-mutex_attribute.c b/level_0/f_thread/c/thread/private-mutex_attribute.c deleted file mode 100644 index 08fdc0b..0000000 --- a/level_0/f_thread/c/thread/private-mutex_attribute.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "../thread.h" -#include "private-mutex_attribute.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_mutex_attributes_adjust_) || !defined(_di_f_thread_mutex_attributes_decimate_by_) || !defined(_di_f_thread_mutex_attributes_decrease_) || !defined(_di_f_thread_mutex_attributes_decrease_by_) || !defined(_di_f_thread_mutex_attributes_increase_) || !defined(_di_f_thread_mutex_attributes_increase_by_) || !defined(_di_f_thread_mutex_attributes_resize_) - f_status_t private_f_thread_mutex_attribute_delete(f_thread_mutex_attribute_t *structure) { - - const int error = pthread_mutexattr_destroy(structure); - - if (error) { - if (error == EBUSY) return F_status_set_error(F_busy); - if (error == EINVAL) return F_status_set_error(F_parameter); - - return F_status_set_error(F_failure); - } - - return F_none; - } -#endif // !defined(_di_f_thread_mutex_attributes_adjust_) || !defined(_di_f_thread_mutex_attributes_decimate_by_) || !defined(_di_f_thread_mutex_attributes_decrease_) || !defined(_di_f_thread_mutex_attributes_decrease_by_) || !defined(_di_f_thread_mutex_attributes_increase_) || !defined(_di_f_thread_mutex_attributes_increase_by_) || !defined(_di_f_thread_mutex_attributes_resize_) - -#if !defined(_di_f_thread_mutex_attributes_adjust_) || !defined(_di_f_thread_mutex_attributes_decimate_by_) - f_status_t private_f_thread_mutex_attributes_adjust(const f_number_unsigned_t length, f_thread_mutex_attributes_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_mutex_attribute_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_mutex_attribute_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_mutex_attributes_adjust_) || !defined(_di_f_thread_mutex_attributes_decimate_by_) - -#if !defined(_di_f_thread_mutex_attributes_decrease_) || !defined(_di_f_thread_mutex_attributes_decrease_by_) || !defined(_di_f_thread_mutex_attributes_increase_) || !defined(_di_f_thread_mutex_attributes_increase_by_) - f_status_t private_f_thread_mutex_attributes_resize(const f_number_unsigned_t length, f_thread_mutex_attributes_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_mutex_attribute_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_mutex_attribute_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_mutex_attributes_decrease_) || !defined(_di_f_thread_mutex_attributes_decrease_by_) || !defined(_di_f_thread_mutex_attributes_increase_) || !defined(_di_f_thread_mutex_attributes_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-mutex_attribute.h b/level_0/f_thread/c/thread/private-mutex_attribute.h deleted file mode 100644 index 2a0b863..0000000 --- a/level_0/f_thread/c/thread/private-mutex_attribute.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_mutex_attribute_h -#define _PRIVATE_F_thread_mutex_attribute_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param structure - * The attribute to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_mutexattr_destroy() - * - * @see f_thread_mutex_attributes_adjust() - * @see f_thread_mutex_attributes_decimate_by() - * @see f_thread_mutex_attributes_decrease() - * @see f_thread_mutex_attributes_decrease_by() - * @see f_thread_mutex_attributes_increase() - * @see f_thread_mutex_attributes_increase_by() - * @see f_thread_mutex_attributes_resize() - */ -#if !defined(_di_f_thread_mutex_attributes_adjust_) || !defined(_di_f_thread_mutex_attributes_decimate_by_) || !defined(_di_f_thread_mutex_attributes_decrease_) || !defined(_di_f_thread_mutex_attributes_decrease_by_) || !defined(_di_f_thread_mutex_attributes_increase_) || !defined(_di_f_thread_mutex_attributes_increase_by_) || !defined(_di_f_thread_mutex_attributes_resize_) - extern f_status_t private_f_thread_mutex_attribute_delete(f_thread_mutex_attribute_t *structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_mutex_attributes_adjust_) || !defined(_di_f_thread_mutex_attributes_decimate_by_) || !defined(_di_f_thread_mutex_attributes_decrease_) || !defined(_di_f_thread_mutex_attributes_decrease_by_) || !defined(_di_f_thread_mutex_attributes_increase_) || !defined(_di_f_thread_mutex_attributes_increase_by_) || !defined(_di_f_thread_mutex_attributes_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The mutex_attributes to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_mutex_attributes_adjust() - * @see f_thread_mutex_attributes_decimate_by() - */ -#if !defined(_di_f_thread_mutex_attributes_adjust_) || !defined(_di_f_thread_mutex_attributes_decimate_by_) - extern f_status_t private_f_thread_mutex_attributes_adjust(const f_number_unsigned_t length, f_thread_mutex_attributes_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_mutex_attributes_adjust_) || !defined(_di_f_thread_mutex_attributes_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The mutex_attributes to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_mutex_attributes_decrease_by() - * @see f_thread_mutex_attributes_increase() - * @see f_thread_mutex_attributes_increase_by() - */ -#if !defined(_di_f_thread_mutex_attributes_decrease_by_) || !defined(_di_f_thread_mutex_attributes_increase_) || !defined(_di_f_thread_mutex_attributes_increase_by_) - extern f_status_t private_f_thread_mutex_attributes_resize(const f_number_unsigned_t length, f_thread_mutex_attributes_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_mutex_attributes_decrease_by_) || !defined(_di_f_thread_mutex_attributes_increase_) || !defined(_di_f_thread_mutex_attributes_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_mutex_attribute_h diff --git a/level_0/f_thread/c/thread/private-semaphore.c b/level_0/f_thread/c/thread/private-semaphore.c deleted file mode 100644 index e01b53b..0000000 --- a/level_0/f_thread/c/thread/private-semaphore.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "../thread.h" -#include "private-semaphore.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_semaphores_adjust_) || !defined(_di_f_thread_semaphores_decimate_by_) || !defined(_di_f_thread_semaphores_decrease_) || !defined(_di_f_thread_semaphores_decrease_by_) || !defined(_di_f_thread_semaphores_increase_) || !defined(_di_f_thread_semaphores_increase_by_) || !defined(_di_f_thread_semaphores_resize_) - f_status_t private_f_thread_semaphore_delete(f_thread_semaphore_t *structure) { - - const int result = sem_destroy(structure); - - if (result == -1) { - if (errno == EINVAL) return F_status_set_error(F_parameter); - - return F_status_set_error(F_failure); - } - - return F_none; - } -#endif // !defined(_di_f_thread_semaphores_adjust_) || !defined(_di_f_thread_semaphores_decimate_by_) || !defined(_di_f_thread_semaphores_decrease_) || !defined(_di_f_thread_semaphores_decrease_by_) || !defined(_di_f_thread_semaphores_increase_) || !defined(_di_f_thread_semaphores_increase_by_) || !defined(_di_f_thread_semaphores_resize_) - -#if !defined(_di_f_thread_semaphores_adjust_) || !defined(_di_f_thread_semaphores_decimate_by_) - f_status_t private_f_thread_semaphores_adjust(const f_number_unsigned_t length, f_thread_semaphores_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_semaphore_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_semaphore_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_semaphores_adjust_) || !defined(_di_f_thread_semaphores_decimate_by_) - -#if !defined(_di_f_thread_semaphores_decrease_) || !defined(_di_f_thread_semaphores_decrease_by_) || !defined(_di_f_thread_semaphores_increase_) || !defined(_di_f_thread_semaphores_increase_by_) - f_status_t private_f_thread_semaphores_resize(const f_number_unsigned_t length, f_thread_semaphores_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_semaphore_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_semaphore_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_semaphores_decrease_) || !defined(_di_f_thread_semaphores_decrease_by_) || !defined(_di_f_thread_semaphores_increase_) || !defined(_di_f_thread_semaphores_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-semaphore.h b/level_0/f_thread/c/thread/private-semaphore.h deleted file mode 100644 index 06ffc6d..0000000 --- a/level_0/f_thread/c/thread/private-semaphore.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_semaphore_h -#define _PRIVATE_F_thread_semaphore_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param structure - * The semaphores to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see sem_destroy() - * - * @see f_thread_semaphores_adjust() - * @see f_thread_semaphores_decimate_by() - * @see f_thread_semaphores_decrease() - * @see f_thread_semaphores_decrease_by() - * @see f_thread_semaphores_increase() - * @see f_thread_semaphores_increase_by() - * @see f_thread_semaphores_resize() - */ -#if !defined(_di_f_thread_semaphores_adjust_) || !defined(_di_f_thread_semaphores_decimate_by_) || !defined(_di_f_thread_semaphores_decrease_) || !defined(_di_f_thread_semaphores_decrease_by_) || !defined(_di_f_thread_semaphores_increase_) || !defined(_di_f_thread_semaphores_increase_by_) || !defined(_di_f_thread_semaphores_resize_) - extern f_status_t private_f_thread_semaphore_delete(f_thread_semaphore_t *structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_semaphores_adjust_) || !defined(_di_f_thread_semaphores_decimate_by_) || !defined(_di_f_thread_semaphores_decrease_) || !defined(_di_f_thread_semaphores_decrease_by_) || !defined(_di_f_thread_semaphores_increase_) || !defined(_di_f_thread_semaphores_increase_by_) || !defined(_di_f_thread_semaphores_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The semaphores to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_semaphores_adjust() - * @see f_thread_semaphores_decimate_by() - */ -#if !defined(_di_f_thread_semaphores_adjust_) || !defined(_di_f_thread_semaphores_decimate_by_) - extern f_status_t private_f_thread_semaphores_adjust(const f_number_unsigned_t length, f_thread_semaphores_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_semaphores_adjust_) || !defined(_di_f_thread_semaphores_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The semaphores to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_semaphores_decrease_by() - * @see f_thread_semaphores_increase() - * @see f_thread_semaphores_increase_by() - */ -#if !defined(_di_f_thread_semaphores_decrease_by_) || !defined(_di_f_thread_semaphores_increase_) || !defined(_di_f_thread_semaphores_increase_by_) - extern f_status_t private_f_thread_semaphores_resize(const f_number_unsigned_t length, f_thread_semaphores_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_semaphores_decrease_by_) || !defined(_di_f_thread_semaphores_increase_) || !defined(_di_f_thread_semaphores_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_semaphore_h diff --git a/level_0/f_thread/c/thread/private-set.c b/level_0/f_thread/c/thread/private-set.c deleted file mode 100644 index 97b1370..0000000 --- a/level_0/f_thread/c/thread/private-set.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "../thread.h" -#include "private-attribute.h" -#include "private-set.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_sets_adjust_) || !defined(_di_f_thread_sets_decimate_by_) - f_status_t private_f_thread_sets_adjust(const f_number_unsigned_t length, f_thread_sets_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_attribute_delete(&structure->array[i].attribute); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_set_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_sets_adjust_) || !defined(_di_f_thread_sets_decimate_by_) - -#if !defined(_di_f_thread_sets_decrease_) || !defined(_di_f_thread_sets_decrease_by_) || !defined(_di_f_thread_sets_increase_) || !defined(_di_f_thread_sets_increase_by_) - f_status_t private_f_thread_sets_resize(const f_number_unsigned_t length, f_thread_sets_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_attribute_delete(&structure->array[i].attribute); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_set_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_sets_decrease_) || !defined(_di_f_thread_sets_decrease_by_) || !defined(_di_f_thread_sets_increase_) || !defined(_di_f_thread_sets_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-set.h b/level_0/f_thread/c/thread/private-set.h deleted file mode 100644 index 2f95a45..0000000 --- a/level_0/f_thread/c/thread/private-set.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_set_h -#define _PRIVATE_F_thread_set_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The sets to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_sets_adjust() - * @see f_thread_sets_decimate_by() - */ -#if !defined(_di_f_thread_sets_adjust_) || !defined(_di_f_thread_sets_decimate_by_) - extern f_status_t private_f_thread_sets_adjust(const f_number_unsigned_t length, f_thread_sets_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_sets_adjust_) || !defined(_di_f_thread_sets_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The sets to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_sets_decrease_by() - * @see f_thread_sets_increase() - * @see f_thread_sets_increase_by() - */ -#if !defined(_di_f_thread_sets_decrease_by_) || !defined(_di_f_thread_sets_increase_) || !defined(_di_f_thread_sets_increase_by_) - extern f_status_t private_f_thread_sets_resize(const f_number_unsigned_t length, f_thread_sets_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_sets_decrease_by_) || !defined(_di_f_thread_sets_increase_) || !defined(_di_f_thread_sets_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_set_h diff --git a/level_0/f_thread/c/thread/private-spin.c b/level_0/f_thread/c/thread/private-spin.c deleted file mode 100644 index 5251c77..0000000 --- a/level_0/f_thread/c/thread/private-spin.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "../thread.h" -#include "private-spin.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_thread_spins_adjust_) || !defined(_di_f_thread_spins_decimate_by_) || !defined(_di_f_thread_spins_decrease_) || !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) || !defined(_di_f_thread_spins_resize_) - f_status_t private_f_thread_spin_delete(f_thread_spin_t *structure) { - - const int error = pthread_spin_destroy(structure); - - if (error) { - if (error == EBUSY) return F_status_set_error(F_busy); - if (error == EINVAL) return F_status_set_error(F_parameter); - - return F_status_set_error(F_failure); - } - - return F_none; - } -#endif // !defined(_di_f_thread_spins_adjust_) || !defined(_di_f_thread_spins_decimate_by_) || !defined(_di_f_thread_spins_decrease_) || !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) || !defined(_di_f_thread_spins_resize_) - -#if !defined(_di_f_thread_spins_adjust_) || !defined(_di_f_thread_spins_decimate_by_) - f_status_t private_f_thread_spins_adjust(const f_number_unsigned_t length, f_thread_spins_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_spin_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_spin_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_spins_adjust_) || !defined(_di_f_thread_spins_decimate_by_) - -#if !defined(_di_f_thread_spins_decrease_) || !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) - f_status_t private_f_thread_spins_resize(const f_number_unsigned_t length, f_thread_spins_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_spin_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_spin_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_thread_spins_decrease_) || !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_thread/c/thread/private-spin.h b/level_0/f_thread/c/thread/private-spin.h deleted file mode 100644 index c38d35d..0000000 --- a/level_0/f_thread/c/thread/private-spin.h +++ /dev/null @@ -1,100 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Thread - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_thread_spin_h -#define _PRIVATE_F_thread_spin_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for deleting (and destroying). - * - * Intended to be shared to each of the different implementation variations. - * - * @param structure - * The spins to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_spin_destroy() - * - * @see f_thread_spins_adjust() - * @see f_thread_spins_decimate_by() - * @see f_thread_spins_decrease() - * @see f_thread_spins_decrease_by() - * @see f_thread_spins_increase() - * @see f_thread_spins_increase_by() - * @see f_thread_spins_resize() - */ -#if !defined(_di_f_thread_spins_adjust_) || !defined(_di_f_thread_spins_decimate_by_) || !defined(_di_f_thread_spins_decrease_) || !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) || !defined(_di_f_thread_spins_resize_) - extern f_status_t private_f_thread_spin_delete(f_thread_spin_t *structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_spins_adjust_) || !defined(_di_f_thread_spins_decimate_by_) || !defined(_di_f_thread_spins_decrease_) || !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) || !defined(_di_f_thread_spins_resize_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The spins to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_spins_adjust() - * @see f_thread_spins_decimate_by() - */ -#if !defined(_di_f_thread_spins_adjust_) || !defined(_di_f_thread_spins_decimate_by_) - extern f_status_t private_f_thread_spins_adjust(const f_number_unsigned_t length, f_thread_spins_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_spins_adjust_) || !defined(_di_f_thread_spins_decimate_by_) - -/** - * Private implementation for resizing. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The new size to use. - * @param structure - * The spins to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_spins_decrease_by() - * @see f_thread_spins_increase() - * @see f_thread_spins_increase_by() - */ -#if !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) - extern f_status_t private_f_thread_spins_resize(const f_number_unsigned_t length, f_thread_spins_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_thread_spins_decrease_by_) || !defined(_di_f_thread_spins_increase_) || !defined(_di_f_thread_spins_increase_by_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_thread_spin_h diff --git a/level_0/f_thread/c/thread/semaphore.c b/level_0/f_thread/c/thread/semaphore.c index 366dda0..484c923 100644 --- a/level_0/f_thread/c/thread/semaphore.c +++ b/level_0/f_thread/c/thread/semaphore.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-semaphore.h" #include "semaphore.h" #ifdef __cplusplus @@ -12,7 +11,11 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_semaphores_adjust(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (sem_destroy(&structure->array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_semaphore_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_semaphores_adjust_ @@ -24,7 +27,13 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_semaphores_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (sem_destroy(&structure->array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_semaphore_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_semaphores_decimate_by_ @@ -36,7 +45,13 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_semaphores_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (sem_destroy(&structure->array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_semaphore_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_semaphores_decrease_by_ @@ -55,7 +70,11 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_semaphores_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (sem_destroy(&structure->array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_semaphore_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +95,11 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_semaphores_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (sem_destroy(&structure->array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_semaphore_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +113,11 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_semaphores_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (sem_destroy(&structure->array[i]) == -1) return (errno == EINVAL) ? F_status_set_error(F_parameter) : F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_semaphore_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_semaphores_resize_ diff --git a/level_0/f_thread/c/thread/set.c b/level_0/f_thread/c/thread/set.c index 2b4f782..f0eb8a7 100644 --- a/level_0/f_thread/c/thread/set.c +++ b/level_0/f_thread/c/thread/set.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-set.h" #include "set.h" #ifdef __cplusplus @@ -12,7 +11,11 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_sets_adjust(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i].attribute)) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_set_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_sets_adjust_ @@ -24,7 +27,13 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_sets_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i].attribute)) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_set_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_sets_decimate_by_ @@ -36,7 +45,13 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_sets_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i].attribute)) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_set_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_sets_decrease_by_ @@ -55,7 +70,11 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_sets_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i].attribute)) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_set_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +95,11 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_sets_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i].attribute)) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_set_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +113,11 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_sets_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_attr_destroy(&structure->array[i].attribute)) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_set_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_sets_resize_ diff --git a/level_0/f_thread/c/thread/spin.c b/level_0/f_thread/c/thread/spin.c index 7bcebc9..6f2f08d 100644 --- a/level_0/f_thread/c/thread/spin.c +++ b/level_0/f_thread/c/thread/spin.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-spin.h" #include "spin.h" #ifdef __cplusplus @@ -12,7 +11,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_spins_adjust(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_spin_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_spin_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_spins_adjust_ @@ -24,7 +39,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_spins_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_spin_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_spin_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_spins_decimate_by_ @@ -36,7 +69,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_spins_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_spin_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_spin_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_spins_decrease_by_ @@ -55,7 +106,23 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_spins_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_spin_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_spin_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +143,23 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_spins_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_spin_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_spin_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +173,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_spins_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_spin_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_spin_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_spins_resize_ diff --git a/level_0/f_thread/data/build/settings b/level_0/f_thread/data/build/settings index efe26df..a88cae1 100644 --- a/level_0/f_thread/data/build/settings +++ b/level_0/f_thread/data/build/settings @@ -35,7 +35,7 @@ build_libraries -lc build_libraries-individual -lf_memory -lf_string build_sources_library thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/condition.c thread/condition_attribute.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/mutex.c thread/mutex_attribute.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c -build_sources_library thread/private-attribute.c thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c thread/private-id.c thread/private-key.c thread/private-lock.c thread/private-lock_attribute.c thread/private-mutex.c thread/private-mutex_attribute.c thread/private-once.c thread/private-semaphore.c thread/private-set.c thread/private-spin.c +build_sources_library thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c build_sources_headers thread.h thread/attribute.h thread/barrier.h thread/barrier_attribute.h thread/condition.h thread/condition_attribute.h thread/id.h thread/key.h thread/lock.h thread/lock_attribute.h thread/mutex.h thread/mutex_attribute.h thread/once.h thread/semaphore.h thread/set.h thread/spin.h diff --git a/level_0/f_thread/data/build/settings-mocks b/level_0/f_thread/data/build/settings-mocks index 11105da..f6703b2 100644 --- a/level_0/f_thread/data/build/settings-mocks +++ b/level_0/f_thread/data/build/settings-mocks @@ -31,7 +31,7 @@ build_libraries -pthread -lc build_libraries-individual -lf_memory -lf_string build_sources_library thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/condition.c thread/condition_attribute.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/mutex.c thread/mutex_attribute.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c ../../tests/unit/c/mock-thread.c -build_sources_library thread/private-attribute.c thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c thread/private-id.c thread/private-key.c thread/private-lock.c thread/private-lock_attribute.c thread/private-mutex.c thread/private-mutex_attribute.c thread/private-once.c thread/private-semaphore.c thread/private-set.c thread/private-spin.c +build_sources_library thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c build_sources_headers thread.h thread/attribute.h thread/barrier.h thread/barrier_attribute.h thread/condition.h thread/condition_attribute.h thread/id.h thread/key.h thread/lock.h thread/lock_attribute.h thread/mutex.h thread/mutex_attribute.h thread/once.h thread/semaphore.h thread/set.h thread/spin.h 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 75580b7..756bdaa 100644 --- a/level_0/f_type_array/c/type_array/poll.c +++ b/level_0/f_type_array/c/type_array/poll.c @@ -1,228 +1,46 @@ #include "../type_array.h" #include "../type_array_file.h" #include "poll.h" -#include "private-poll.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_polls_adjust_ - f_status_t f_polls_adjust(const f_number_unsigned_t length, f_polls_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_polls_adjust_callback_ + f_status_t f_polls_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(f_poll_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_polls_adjust_ - -#ifndef _di_f_polls_append_ - f_status_t f_polls_append(const f_poll_t source, f_polls_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_polls_append(source, destination); - } -#endif // _di_f_polls_append_ - -#ifndef _di_f_polls_append_all_ - f_status_t f_polls_append_all(const f_polls_t source, f_polls_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_polls_append_all(source, destination); - } -#endif // _di_f_polls_append_all_ - -#ifndef _di_f_polls_decimate_by_ - f_status_t f_polls_decimate_by(const f_number_unsigned_t amount, f_polls_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_poll_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_polls_decimate_by_ - -#ifndef _di_f_polls_decrease_by_ - f_status_t f_polls_decrease_by(const f_number_unsigned_t amount, f_polls_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(f_poll_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_polls_decrease_by_ - -#ifndef _di_f_polls_increase_ - f_status_t f_polls_increase(const f_number_unsigned_t step, f_polls_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_poll_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_polls_increase_ - -#ifndef _di_f_polls_increase_by_ - f_status_t f_polls_increase_by(const f_number_unsigned_t amount, f_polls_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_poll_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_polls_increase_by_ - -#ifndef _di_f_polls_resize_ - f_status_t f_polls_resize(const f_number_unsigned_t length, f_polls_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(f_poll_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_polls_resize_ - -#ifndef _di_f_pollss_adjust_ - f_status_t f_pollss_adjust(const f_number_unsigned_t length, f_pollss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_pollss_adjust(length, structure); - } -#endif // _di_f_pollss_adjust_ - -#ifndef _di_f_pollss_append_ - f_status_t f_pollss_append(const f_polls_t source, f_pollss_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_polls_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_polls_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_polls_t * const array = (f_polls_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_pollss_append_ - -#ifndef _di_f_pollss_append_all_ - f_status_t f_pollss_append_all(const f_pollss_t source, f_pollss_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_polls_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) { - - destination->array[destination->used].used = 0; - - if (source.array[i].used) { - status = private_f_polls_append_all(source.array[i], &destination->array[destination->used]); + 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; - } - } // for - - return F_none; - } -#endif // _di_f_pollss_append_all_ - -#ifndef _di_f_pollss_decimate_by_ - f_status_t f_pollss_decimate_by(const f_number_unsigned_t amount, f_pollss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_pollss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_pollss_decimate_by_ - -#ifndef _di_f_pollss_decrease_by_ - f_status_t f_pollss_decrease_by(const f_number_unsigned_t amount, f_pollss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_pollss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_pollss_decrease_by_ - -#ifndef _di_f_pollss_increase_ - f_status_t f_pollss_increase(const f_number_unsigned_t step, f_pollss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_pollss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_pollss_increase_ - -#ifndef _di_f_pollss_increase_by_ - f_status_t f_pollss_increase_by(const f_number_unsigned_t amount, f_pollss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_polls_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_polls_resize_callback_ + f_status_t f_polls_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_polls_t * const array = (f_polls_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_pollss_resize(structure->used + amount, structure); - } + 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; + } // for } - return F_data_not; - } -#endif // _di_f_pollss_increase_by_ - -#ifndef _di_f_pollss_resize_ - f_status_t f_pollss_resize(const f_number_unsigned_t length, f_pollss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_pollss_resize(length, structure); + return F_none; } -#endif // _di_f_pollss_resize_ +#endif // _di_f_polls_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/poll.h b/level_0/f_type_array/c/type_array/poll.h index 29d36c9..bf2d72c 100644 --- a/level_0/f_type_array/c/type_array/poll.h +++ b/level_0/f_type_array/c/type_array/poll.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string polls array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_pollss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string polls array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_polls_adjust_ - extern f_status_t f_polls_adjust(const f_number_unsigned_t length, f_polls_t * const structure); -#endif // _di_f_polls_adjust_ - -/** - * Append the single source poll onto the destination. - * - * @param source - * The source poll to append. - * @param destination - * The destination polls the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_polls_append_ - extern f_status_t f_polls_append(const f_poll_t source, f_polls_t * const destination); -#endif // _di_f_polls_append_ - -/** - * Append the source polls onto the destination. - * - * @param source - * The source polls to append. - * @param destination - * The destination polls the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_polls_append_all_ - extern f_status_t f_polls_append_all(const f_polls_t source, f_polls_t * const destination); -#endif // _di_f_polls_append_all_ - -/** - * Resize the string polls array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param structure - * The string polls array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_polls_decimate_by_ - extern f_status_t f_polls_decimate_by(const f_number_unsigned_t amount, f_polls_t * const structure); -#endif // _di_f_polls_decimate_by_ - -/** - * Resize the string polls array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param structure - * The string polls array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_polls_decrease_by_ - extern f_status_t f_polls_decrease_by(const f_number_unsigned_t amount, f_polls_t * const structure); -#endif // _di_f_polls_decrease_by_ - -/** - * Increase the size of the string polls array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string polls array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_polls_increase_ - extern f_status_t f_polls_increase(const f_number_unsigned_t step, f_polls_t * const structure); -#endif // _di_f_polls_increase_ - -/** - * Resize the string polls array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param structure - * The string polls array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_polls_increase_by_ - extern f_status_t f_polls_increase_by(const f_number_unsigned_t amount, f_polls_t * const structure); -#endif // _di_f_polls_increase_by_ - -/** - * Resize the string polls array. - * - * @param length - * The new size to use. - * @param structure - * The string polls array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_polls_resize_ - extern f_status_t f_polls_resize(const f_number_unsigned_t length, f_polls_t * const structure); -#endif // _di_f_polls_resize_ - -/** - * Resize the string pollss array. - * - * @param length - * The new size to use. - * @param structure - * The string pollss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_pollss_adjust_ - extern f_status_t f_pollss_adjust(const f_number_unsigned_t length, f_pollss_t * const structure); -#endif // _di_f_pollss_adjust_ - -/** - * Append the single source polls onto the destination. - * - * @param source - * The source polls to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_pollss_append_ - extern f_status_t f_pollss_append(const f_polls_t source, f_pollss_t * const destination); -#endif // _di_f_pollss_append_ - -/** - * Append the source pollss onto the destination. - * - * @param source - * The source pollss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_pollss_append_all_ - extern f_status_t f_pollss_append_all(const f_pollss_t source, f_pollss_t * const destination); -#endif // _di_f_pollss_append_all_ - -/** - * Resize the string pollss array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param structure - * The string pollss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_pollss_decimate_by_ - extern f_status_t f_pollss_decimate_by(const f_number_unsigned_t amount, f_pollss_t * const structure); -#endif // _di_f_pollss_decimate_by_ - -/** - * Resize the string pollss array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param structure - * The string pollss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_pollss_decrease_by_ - extern f_status_t f_pollss_decrease_by(const f_number_unsigned_t amount, f_pollss_t * const structure); -#endif // _di_f_pollss_decrease_by_ +#ifndef _di_f_polls_adjust_callback_ + extern f_status_t f_polls_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_polls_adjust_callback_ /** - * Increase the size of the string pollss array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * A callback intended to be passed to f_memory_arrays_resize() for an f_pollss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string pollss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_pollss_increase_ - extern f_status_t f_pollss_increase(const f_number_unsigned_t step, f_pollss_t * const structure); -#endif // _di_f_pollss_increase_ - -/** - * Resize the string pollss array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param structure - * The string pollss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_pollss_increase_by_ - extern f_status_t f_pollss_increase_by(const f_number_unsigned_t amount, f_pollss_t * const structure); -#endif // _di_f_pollss_increase_by_ - -/** - * Resize the string pollss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string pollss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_pollss_resize_ - extern f_status_t f_pollss_resize(const f_number_unsigned_t length, f_pollss_t * const structure); -#endif // _di_f_pollss_resize_ +#ifndef _di_f_polls_resize_callback_ + extern f_status_t f_polls_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_polls_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/private-poll.c b/level_0/f_type_array/c/type_array/private-poll.c deleted file mode 100644 index 2623355..0000000 --- a/level_0/f_type_array/c/type_array/private-poll.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "../type_array.h" -#include "../type_array_file.h" -#include "private-poll.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_polls_append_) || !defined(_di_f_pollss_append_) - extern f_status_t private_f_polls_append(const f_poll_t source, f_polls_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_poll_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_polls_append_) || !defined(_di_f_pollss_append_) - -#if !defined(_di_f_polls_append_) || !defined(_di_f_polls_append_all_) || !defined(_di_f_pollss_append_all_) - extern f_status_t private_f_polls_append_all(const f_polls_t source, f_polls_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_poll_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - destination->array[destination->used++] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_polls_append_) || !defined(_di_f_polls_append_all_) || !defined(_di_f_pollss_append_all_) - -#if !defined(_di_f_pollss_adjust_) || !defined(_di_f_pollss_decimate_by_) - f_status_t private_f_pollss_adjust(const f_number_unsigned_t length, f_pollss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(f_poll_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_polls_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_pollss_adjust_) || !defined(_di_f_pollss_decimate_by_) - -#if !defined(_di_f_pollss_decrease_by_) || !defined(_di_f_pollss_increase_) || !defined(_di_f_pollss_increase_by_) || !defined(_di_f_pollss_resize_) - f_status_t private_f_pollss_resize(const f_number_unsigned_t length, f_pollss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_poll_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_polls_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_pollss_decrease_by_) || !defined(_di_f_pollss_increase_) || !defined(_di_f_pollss_increase_by_) || !defined(_di_f_pollss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-poll.h b/level_0/f_type_array/c/type_array/private-poll.h deleted file mode 100644 index 0a42519..0000000 --- a/level_0/f_type_array/c/type_array/private-poll.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_type_array_poll_h -#define _PRIVATE_F_type_array_poll_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the poll array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source poll to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_polls_append() - * @see f_pollss_append() - */ -#if !defined(_di_f_polls_append_) || !defined(_di_f_pollss_append_) - extern f_status_t private_f_polls_append(const f_poll_t source, f_polls_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_polls_append_) || !defined(_di_f_pollss_append_) - -/** - * Private implementation for appending the poll array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source polls to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_polls_append_all() - * @see f_pollss_append() - * @see f_pollss_append_all() - */ -#if !defined(_di_f_polls_append_) || !defined(_di_f_polls_append_all_) || !defined(_di_f_pollss_append_all_) - extern f_status_t private_f_polls_append_all(const f_polls_t source, f_polls_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_polls_append_) || !defined(_di_f_polls_append_all_) || !defined(_di_f_pollss_append_all_) - -/** - * Private implementation for resizing the pollss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The pollss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if new length is larger than max array length. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - * - * @see f_pollss_adjust() - * @see f_pollss_decimate_by() - */ -#if !defined(_di_f_pollss_adjust_) || !defined(_di_f_pollss_decimate_by_) - extern f_status_t private_f_pollss_adjust(const f_number_unsigned_t length, f_pollss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_pollss_adjust_) || !defined(_di_f_pollss_decimate_by_) - -/** - * Private implementation for resizing the pollss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The pollss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if new length is larger than max array length. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_pollss_decrease_by() - * @see f_pollss_increase() - * @see f_pollss_increase_by() - * @see f_pollss_resize() - */ -#if !defined(_di_f_pollss_decrease_by_) || !defined(_di_f_pollss_increase_) || !defined(_di_f_pollss_increase_by_) || !defined(_di_f_pollss_resize_) - extern f_status_t private_f_pollss_resize(const f_number_unsigned_t length, f_pollss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_pollss_decrease_by_) || !defined(_di_f_pollss_increase_) || !defined(_di_f_pollss_increase_by_) || !defined(_di_f_pollss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_poll_h diff --git a/level_0/f_type_array/c/type_array/private-state.c b/level_0/f_type_array/c/type_array/private-state.c deleted file mode 100644 index b3875b0..0000000 --- a/level_0/f_type_array/c/type_array/private-state.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-state.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_states_append_) || !defined(_di_f_statess_append_) - extern f_status_t private_f_states_append(const f_state_t source, f_states_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_state_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_states_append_) || !defined(_di_f_statess_append_) - -#if !defined(_di_f_states_append_) || !defined(_di_f_states_append_all_) || !defined(_di_f_statess_append_all_) - extern f_status_t private_f_states_append_all(const f_states_t source, f_states_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_state_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - destination->array[destination->used++] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_states_append_) || !defined(_di_f_states_append_all_) || !defined(_di_f_statess_append_all_) - -#if !defined(_di_f_statess_adjust_) || !defined(_di_f_statess_decimate_by_) - f_status_t private_f_statess_adjust(const f_number_unsigned_t length, f_statess_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(f_state_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_states_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_statess_adjust_) || !defined(_di_f_statess_decimate_by_) - -#if !defined(_di_f_statess_decrease_by_) || !defined(_di_f_statess_increase_) || !defined(_di_f_statess_increase_by_) || !defined(_di_f_statess_resize_) - f_status_t private_f_statess_resize(const f_number_unsigned_t length, f_statess_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_state_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_states_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_statess_decrease_by_) || !defined(_di_f_statess_increase_) || !defined(_di_f_statess_increase_by_) || !defined(_di_f_statess_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-state.h b/level_0/f_type_array/c/type_array/private-state.h deleted file mode 100644 index 5293cd6..0000000 --- a/level_0/f_type_array/c/type_array/private-state.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_type_array_state_h -#define _PRIVATE_F_type_array_state_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the state array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source state to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_states_append() - * @see f_statess_append() - */ -#if !defined(_di_f_states_append_) || !defined(_di_f_statess_append_) - extern f_status_t private_f_states_append(const f_state_t source, f_states_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_states_append_) || !defined(_di_f_statess_append_) - -/** - * Private implementation for appending the state array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source states to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_states_append_all() - * @see f_statess_append() - * @see f_statess_append_all() - */ -#if !defined(_di_f_states_append_) || !defined(_di_f_states_append_all_) || !defined(_di_f_statess_append_all_) - extern f_status_t private_f_states_append_all(const f_states_t source, f_states_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_states_append_) || !defined(_di_f_states_append_all_) || !defined(_di_f_statess_append_all_) - -/** - * Private implementation for resizing the statess array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The statess array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if new length is larger than max array length. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - * - * @see f_statess_adjust() - * @see f_statess_decimate_by() - */ -#if !defined(_di_f_statess_adjust_) || !defined(_di_f_statess_decimate_by_) - extern f_status_t private_f_statess_adjust(const f_number_unsigned_t length, f_statess_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_statess_adjust_) || !defined(_di_f_statess_decimate_by_) - -/** - * Private implementation for resizing the statess array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The statess array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if new length is larger than max array length. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_statess_decrease_by() - * @see f_statess_increase() - * @see f_statess_increase_by() - * @see f_statess_resize() - */ -#if !defined(_di_f_statess_decrease_by_) || !defined(_di_f_statess_increase_) || !defined(_di_f_statess_increase_by_) || !defined(_di_f_statess_resize_) - extern f_status_t private_f_statess_resize(const f_number_unsigned_t length, f_statess_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_statess_decrease_by_) || !defined(_di_f_statess_increase_) || !defined(_di_f_statess_increase_by_) || !defined(_di_f_statess_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_state_h diff --git a/level_0/f_type_array/c/type_array/private-status.c b/level_0/f_type_array/c/type_array/private-status.c deleted file mode 100644 index 659e2c0..0000000 --- a/level_0/f_type_array/c/type_array/private-status.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "../type_array.h" -#include "private-status.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_di_f_statuss_append_) || !defined(_di_f_statusss_append_) - extern f_status_t private_f_statuss_append(const f_status_t source, f_statuss_t * const destination) { - - { - const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_status_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - destination->array[destination->used++] = source; - - return F_none; - } -#endif // !defined(_di_f_statuss_append_) || !defined(_di_f_statusss_append_) - -#if !defined(_di_f_statuss_append_) || !defined(_di_f_statuss_append_all_) || !defined(_di_f_statusss_append_all_) - extern f_status_t private_f_statuss_append_all(const f_statuss_t source, f_statuss_t * const destination) { - - { - const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_status_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - } - - for (f_number_unsigned_t i = 0; i < source.used; ++i) { - destination->array[destination->used++] = source.array[i]; - } // for - - return F_none; - } -#endif // !defined(_di_f_statuss_append_) || !defined(_di_f_statuss_append_all_) || !defined(_di_f_statusss_append_all_) - -#if !defined(_di_f_statusss_adjust_) || !defined(_di_f_statusss_decimate_by_) - f_status_t private_f_statusss_adjust(const f_number_unsigned_t length, f_statusss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_adjust(0, sizeof(f_status_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_statuss_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_statusss_adjust_) || !defined(_di_f_statusss_decimate_by_) - -#if !defined(_di_f_statusss_decrease_by_) || !defined(_di_f_statusss_increase_) || !defined(_di_f_statusss_increase_by_) || !defined(_di_f_statusss_resize_) - f_status_t private_f_statusss_resize(const f_number_unsigned_t length, f_statusss_t * const structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = f_memory_array_resize(0, sizeof(f_status_t), (void **) &structure->array[i].array, &structure->array[i].used, &structure->array[i].size); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_statuss_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // !defined(_di_f_statusss_decrease_by_) || !defined(_di_f_statusss_increase_) || !defined(_di_f_statusss_increase_by_) || !defined(_di_f_statusss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif diff --git a/level_0/f_type_array/c/type_array/private-status.h b/level_0/f_type_array/c/type_array/private-status.h deleted file mode 100644 index 3c099d7..0000000 --- a/level_0/f_type_array/c/type_array/private-status.h +++ /dev/null @@ -1,131 +0,0 @@ -/** - * FLL - Level 0 - * - * Project: Type - * API Version: 0.7 - * Licenses: lgpl-2.1-or-later - * - * These are provided for internal reduction in redundant code. - * These should not be exposed/used outside of this project. - */ -#ifndef _PRIVATE_F_type_array_status_h -#define _PRIVATE_F_type_array_status_h - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Private implementation for appending the status array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source status to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - * - * @see f_statuss_append() - * @see f_statusss_append() - */ -#if !defined(_di_f_statuss_append_) || !defined(_di_f_statusss_append_) - extern f_status_t private_f_statuss_append(const f_status_t source, f_statuss_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_statuss_append_) || !defined(_di_f_statusss_append_) - -/** - * Private implementation for appending the status array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param source - * The source statuss to append. - * @param destination - * The destination lengths the source is appended onto. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - * - * @see f_statuss_append_all() - * @see f_statusss_append() - * @see f_statusss_append_all() - */ -#if !defined(_di_f_statuss_append_) || !defined(_di_f_statuss_append_all_) || !defined(_di_f_statusss_append_all_) - extern f_status_t private_f_statuss_append_all(const f_statuss_t source, f_statuss_t * const destination) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_statuss_append_) || !defined(_di_f_statuss_append_all_) || !defined(_di_f_statusss_append_all_) - -/** - * Private implementation for resizing the statusss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to adjust to. - * @param structure - * The statusss array to adjust. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if new length is larger than max array length. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - * - * @see f_statusss_adjust() - * @see f_statusss_decimate_by() - */ -#if !defined(_di_f_statusss_adjust_) || !defined(_di_f_statusss_decimate_by_) - extern f_status_t private_f_statusss_adjust(const f_number_unsigned_t length, f_statusss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_statusss_adjust_) || !defined(_di_f_statusss_decimate_by_) - -/** - * Private implementation for resizing the statusss array. - * - * Intended to be shared to each of the different implementation variations. - * - * @param length - * The length to resize to. - * @param structure - * The statusss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if new length is larger than max array length. - * F_memory_not (with error bit) on out of memory. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_statusss_decrease_by() - * @see f_statusss_increase() - * @see f_statusss_increase_by() - * @see f_statusss_resize() - */ -#if !defined(_di_f_statusss_decrease_by_) || !defined(_di_f_statusss_increase_) || !defined(_di_f_statusss_increase_by_) || !defined(_di_f_statusss_resize_) - extern f_status_t private_f_statusss_resize(const f_number_unsigned_t length, f_statusss_t * const structure) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_statusss_decrease_by_) || !defined(_di_f_statusss_increase_) || !defined(_di_f_statusss_increase_by_) || !defined(_di_f_statusss_resize_) - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // _PRIVATE_F_type_array_status_h 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 178276d..eee580c 100644 --- a/level_0/f_type_array/c/type_array/state.c +++ b/level_0/f_type_array/c/type_array/state.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "state.h" -#include "private-state.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_states_adjust_ - f_status_t f_states_adjust(const f_number_unsigned_t length, f_states_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_states_adjust_callback_ + f_status_t f_states_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(f_state_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_states_adjust_ - -#ifndef _di_f_states_append_ - f_status_t f_states_append(const f_state_t source, f_states_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_states_append(source, destination); - } -#endif // _di_f_states_append_ - -#ifndef _di_f_states_append_all_ - f_status_t f_states_append_all(const f_states_t source, f_states_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_states_append_all(source, destination); - } -#endif // _di_f_states_append_all_ - -#ifndef _di_f_states_decimate_by_ - f_status_t f_states_decimate_by(const f_number_unsigned_t amount, f_states_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_state_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_states_decimate_by_ - -#ifndef _di_f_states_decrease_by_ - f_status_t f_states_decrease_by(const f_number_unsigned_t amount, f_states_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(f_state_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_states_decrease_by_ - -#ifndef _di_f_states_increase_ - f_status_t f_states_increase(const f_number_unsigned_t step, f_states_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_state_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_states_increase_ - -#ifndef _di_f_states_increase_by_ - f_status_t f_states_increase_by(const f_number_unsigned_t amount, f_states_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_state_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_states_increase_by_ - -#ifndef _di_f_states_resize_ - f_status_t f_states_resize(const f_number_unsigned_t length, f_states_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(f_state_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_states_resize_ - -#ifndef _di_f_statess_adjust_ - f_status_t f_statess_adjust(const f_number_unsigned_t length, f_statess_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_statess_adjust(length, structure); - } -#endif // _di_f_statess_adjust_ - -#ifndef _di_f_statess_append_ - f_status_t f_statess_append(const f_states_t source, f_statess_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_states_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_states_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_states_t * const array = (f_states_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_statess_append_ - -#ifndef _di_f_statess_append_all_ - f_status_t f_statess_append_all(const f_statess_t source, f_statess_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_states_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) { - - destination->array[destination->used].used = 0; - - if (source.array[i].used) { - status = private_f_states_append_all(source.array[i], &destination->array[destination->used]); + 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; - } - } // for - - return F_none; - } -#endif // _di_f_statess_append_all_ - -#ifndef _di_f_statess_decimate_by_ - f_status_t f_statess_decimate_by(const f_number_unsigned_t amount, f_statess_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_statess_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_statess_decimate_by_ - -#ifndef _di_f_statess_decrease_by_ - f_status_t f_statess_decrease_by(const f_number_unsigned_t amount, f_statess_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_statess_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_statess_decrease_by_ - -#ifndef _di_f_statess_increase_ - f_status_t f_statess_increase(const f_number_unsigned_t step, f_statess_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_statess_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_statess_increase_ - -#ifndef _di_f_statess_increase_by_ - f_status_t f_statess_increase_by(const f_number_unsigned_t amount, f_statess_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_states_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_states_resize_callback_ + f_status_t f_states_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_states_t * const array = (f_states_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_statess_resize(structure->used + amount, structure); - } + 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; + } // for } - return F_data_not; - } -#endif // _di_f_statess_increase_by_ - -#ifndef _di_f_statess_resize_ - f_status_t f_statess_resize(const f_number_unsigned_t length, f_statess_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_statess_resize(length, structure); + return F_none; } -#endif // _di_f_statess_resize_ +#endif // _di_f_states_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/state.h b/level_0/f_type_array/c/type_array/state.h index dd30c69..061b05f 100644 --- a/level_0/f_type_array/c/type_array/state.h +++ b/level_0/f_type_array/c/type_array/state.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string states array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_statess_t structure. * - * @param length - * The new size to use. - * @param structure - * The string states array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_states_adjust_ - extern f_status_t f_states_adjust(const f_number_unsigned_t length, f_states_t * const structure); -#endif // _di_f_states_adjust_ - -/** - * Append the single source state onto the destination. - * - * @param source - * The source state to append. - * @param destination - * The destination states the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_states_append_ - extern f_status_t f_states_append(const f_state_t source, f_states_t * const destination); -#endif // _di_f_states_append_ - -/** - * Append the source states onto the destination. - * - * @param source - * The source states to append. - * @param destination - * The destination states the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_states_append_all_ - extern f_status_t f_states_append_all(const f_states_t source, f_states_t * const destination); -#endif // _di_f_states_append_all_ - -/** - * Resize the string states array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param structure - * The string states array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_states_decimate_by_ - extern f_status_t f_states_decimate_by(const f_number_unsigned_t amount, f_states_t * const structure); -#endif // _di_f_states_decimate_by_ - -/** - * Resize the string states array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param structure - * The string states array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_states_decrease_by_ - extern f_status_t f_states_decrease_by(const f_number_unsigned_t amount, f_states_t * const structure); -#endif // _di_f_states_decrease_by_ - -/** - * Increase the size of the string states array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string states array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_states_increase_ - extern f_status_t f_states_increase(const f_number_unsigned_t step, f_states_t * const structure); -#endif // _di_f_states_increase_ - -/** - * Resize the string states array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param structure - * The string states array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_states_increase_by_ - extern f_status_t f_states_increase_by(const f_number_unsigned_t amount, f_states_t * const structure); -#endif // _di_f_states_increase_by_ - -/** - * Resize the string states array. - * - * @param length - * The new size to use. - * @param structure - * The string states array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_states_resize_ - extern f_status_t f_states_resize(const f_number_unsigned_t length, f_states_t * const structure); -#endif // _di_f_states_resize_ - -/** - * Resize the string statess array. - * - * @param length - * The new size to use. - * @param structure - * The string statess array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_statess_adjust_ - extern f_status_t f_statess_adjust(const f_number_unsigned_t length, f_statess_t * const structure); -#endif // _di_f_statess_adjust_ - -/** - * Append the single source states onto the destination. - * - * @param source - * The source states to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_statess_append_ - extern f_status_t f_statess_append(const f_states_t source, f_statess_t * const destination); -#endif // _di_f_statess_append_ - -/** - * Append the source statess onto the destination. - * - * @param source - * The source statess to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_statess_append_all_ - extern f_status_t f_statess_append_all(const f_statess_t source, f_statess_t * const destination); -#endif // _di_f_statess_append_all_ - -/** - * Resize the string statess array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param structure - * The string statess array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_statess_decimate_by_ - extern f_status_t f_statess_decimate_by(const f_number_unsigned_t amount, f_statess_t * const structure); -#endif // _di_f_statess_decimate_by_ - -/** - * Resize the string statess array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param structure - * The string statess array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_statess_decrease_by_ - extern f_status_t f_statess_decrease_by(const f_number_unsigned_t amount, f_statess_t * const structure); -#endif // _di_f_statess_decrease_by_ +#ifndef _di_f_states_adjust_callback_ + extern f_status_t f_states_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_states_adjust_callback_ /** - * Increase the size of the string statess array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * A callback intended to be passed to f_memory_arrays_resize() for an f_statess_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string statess array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_statess_increase_ - extern f_status_t f_statess_increase(const f_number_unsigned_t step, f_statess_t * const structure); -#endif // _di_f_statess_increase_ - -/** - * Resize the string statess array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param structure - * The string statess array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_statess_increase_by_ - extern f_status_t f_statess_increase_by(const f_number_unsigned_t amount, f_statess_t * const structure); -#endif // _di_f_statess_increase_by_ - -/** - * Resize the string statess array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string statess array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_statess_resize_ - extern f_status_t f_statess_resize(const f_number_unsigned_t length, f_statess_t * const structure); -#endif // _di_f_statess_resize_ +#ifndef _di_f_states_resize_callback_ + extern f_status_t f_states_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_states_resize_callback_ #ifdef __cplusplus } // extern "C" 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 dc52567..c64c2cd 100644 --- a/level_0/f_type_array/c/type_array/status.c +++ b/level_0/f_type_array/c/type_array/status.c @@ -1,227 +1,45 @@ #include "../type_array.h" #include "status.h" -#include "private-status.h" #ifdef __cplusplus extern "C" { #endif -#ifndef _di_f_statuss_adjust_ - f_status_t f_statuss_adjust(const f_number_unsigned_t length, f_statuss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#ifndef _di_f_statuss_adjust_callback_ + f_status_t f_statuss_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - return f_memory_array_adjust(length, sizeof(f_status_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_statuss_adjust_ - -#ifndef _di_f_statuss_append_ - f_status_t f_statuss_append(const f_status_t source, f_statuss_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_statuss_append(source, destination); - } -#endif // _di_f_statuss_append_ - -#ifndef _di_f_statuss_append_all_ - f_status_t f_statuss_append_all(const f_statuss_t source, f_statuss_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - return private_f_statuss_append_all(source, destination); - } -#endif // _di_f_statuss_append_all_ - -#ifndef _di_f_statuss_decimate_by_ - f_status_t f_statuss_decimate_by(const f_number_unsigned_t amount, f_statuss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decimate_by(amount, sizeof(f_status_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_statuss_decimate_by_ - -#ifndef _di_f_statuss_decrease_by_ - f_status_t f_statuss_decrease_by(const f_number_unsigned_t amount, f_statuss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_decrease_by(amount, sizeof(f_status_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_statuss_decrease_by_ - -#ifndef _di_f_statuss_increase_ - f_status_t f_statuss_increase(const f_number_unsigned_t step, f_statuss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase(step, sizeof(f_status_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_statuss_increase_ - -#ifndef _di_f_statuss_increase_by_ - f_status_t f_statuss_increase_by(const f_number_unsigned_t amount, f_statuss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_increase_by(amount, sizeof(f_status_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_statuss_increase_by_ - -#ifndef _di_f_statuss_resize_ - f_status_t f_statuss_resize(const f_number_unsigned_t length, f_statuss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return f_memory_array_resize(length, sizeof(f_status_t), (void **) &structure->array, &structure->used, &structure->size); - } -#endif // _di_f_statuss_resize_ - -#ifndef _di_f_statusss_adjust_ - f_status_t f_statusss_adjust(const f_number_unsigned_t length, f_statusss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_statusss_adjust(length, structure); - } -#endif // _di_f_statusss_adjust_ - -#ifndef _di_f_statusss_append_ - f_status_t f_statusss_append(const f_statuss_t source, f_statusss_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; - - f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_statuss_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - status = private_f_statuss_append_all(source, &destination->array[destination->used]); - if (F_status_is_error(status)) return status; - - ++destination->used; + { + f_statuss_t * const array = (f_statuss_t *) void_array; + f_status_t status = F_none; - return F_none; - } -#endif // _di_f_statusss_append_ - -#ifndef _di_f_statusss_append_all_ - f_status_t f_statusss_append_all(const f_statusss_t source, f_statusss_t * const destination) { - #ifndef _di_level_0_parameter_checking_ - if (!destination) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!source.used) return F_data_not; + for (f_number_unsigned_t i = start; i < size; ++i) { - f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_statuss_t), (void **) &destination->array, &destination->used, &destination->size); - if (F_status_is_error(status)) return status; - - for (f_number_unsigned_t i = 0; i < source.used; ++i, ++destination->used) { - - destination->array[destination->used].used = 0; - - if (source.array[i].used) { - status = private_f_statuss_append_all(source.array[i], &destination->array[destination->used]); + 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; - } - } // for - - return F_none; - } -#endif // _di_f_statusss_append_all_ - -#ifndef _di_f_statusss_decimate_by_ - f_status_t f_statusss_decimate_by(const f_number_unsigned_t amount, f_statusss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_statusss_adjust((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_statusss_decimate_by_ - -#ifndef _di_f_statusss_decrease_by_ - f_status_t f_statusss_decrease_by(const f_number_unsigned_t amount, f_statusss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (!amount) return F_data_not; - - return private_f_statusss_resize((structure->size - amount > 0) ? structure->size - amount : 0, structure); - } -#endif // _di_f_statusss_decrease_by_ - -#ifndef _di_f_statusss_increase_ - f_status_t f_statusss_increase(const f_number_unsigned_t step, f_statusss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - if (step && structure->used + 1 > structure->size) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - f_number_unsigned_t length = structure->used + step; - - if (length > F_number_t_size_unsigned_d) { - if (structure->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - - length = F_number_t_size_unsigned_d; - } - - return private_f_statusss_resize(length, structure); + } // for } - return F_data_not; + return F_none; } -#endif // _di_f_statusss_increase_ - -#ifndef _di_f_statusss_increase_by_ - f_status_t f_statusss_increase_by(const f_number_unsigned_t amount, f_statusss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ +#endif // _di_f_statuss_adjust_callback_ - if (amount) { - if (structure->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); +#ifndef _di_f_statuss_resize_callback_ + f_status_t f_statuss_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const void_array) { - const f_number_unsigned_t length = structure->used + amount; + { + f_statuss_t * const array = (f_statuss_t *) void_array; + f_status_t status = F_none; - if (length > structure->size) { - if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); + for (f_number_unsigned_t i = start; i < size; ++i) { - return private_f_statusss_resize(structure->used + amount, structure); - } + 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; + } // for } - return F_data_not; - } -#endif // _di_f_statusss_increase_by_ - -#ifndef _di_f_statusss_resize_ - f_status_t f_statusss_resize(const f_number_unsigned_t length, f_statusss_t * const structure) { - #ifndef _di_level_0_parameter_checking_ - if (!structure) return F_status_set_error(F_parameter); - #endif // _di_level_0_parameter_checking_ - - return private_f_statusss_resize(length, structure); + return F_none; } -#endif // _di_f_statusss_resize_ +#endif // _di_f_statuss_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/c/type_array/status.h b/level_0/f_type_array/c/type_array/status.h index 3a2845d..dbbb40f 100644 --- a/level_0/f_type_array/c/type_array/status.h +++ b/level_0/f_type_array/c/type_array/status.h @@ -17,275 +17,17 @@ extern "C" { #endif /** - * Resize the string statuss array. + * A callback intended to be passed to f_memory_arrays_adjust() for an f_statusss_t structure. * - * @param length - * The new size to use. - * @param structure - * The string statuss array to resize. + * This does not do parameter checking. * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_statuss_adjust_ - extern f_status_t f_statuss_adjust(const f_number_unsigned_t length, f_statuss_t * const structure); -#endif // _di_f_statuss_adjust_ - -/** - * Append the single source status onto the destination. - * - * @param source - * The source status to append. - * @param destination - * The destination statuss the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_statuss_append_ - extern f_status_t f_statuss_append(const f_status_t source, f_statuss_t * const destination); -#endif // _di_f_statuss_append_ - -/** - * Append the source statuss onto the destination. - * - * @param source - * The source statuss to append. - * @param destination - * The destination statuss the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_statuss_append_all_ - extern f_status_t f_statuss_append_all(const f_statuss_t source, f_statuss_t * const destination); -#endif // _di_f_statuss_append_all_ - -/** - * Resize the string statuss array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param structure - * The string statuss array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decimate_by(). - * - * @see f_memory_array_decimate_by() - */ -#ifndef _di_f_statuss_decimate_by_ - extern f_status_t f_statuss_decimate_by(const f_number_unsigned_t amount, f_statuss_t * const structure); -#endif // _di_f_statuss_decimate_by_ - -/** - * Resize the string statuss array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to les than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param structure - * The string statuss array to resize. - * - * @return - * F_none on success. - * F_data_not if amount is 0. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_decrease_by(). - * - * @see f_memory_array_decrease_by() - */ -#ifndef _di_f_statuss_decrease_by_ - extern f_status_t f_statuss_decrease_by(const f_number_unsigned_t amount, f_statuss_t * const structure); -#endif // _di_f_statuss_decrease_by_ - -/** - * Increase the size of the string statuss array, but only if necesary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string statuss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * - * @see f_memory_array_increase() - */ -#ifndef _di_f_statuss_increase_ - extern f_status_t f_statuss_increase(const f_number_unsigned_t step, f_statuss_t * const structure); -#endif // _di_f_statuss_increase_ - -/** - * Resize the string statuss array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param structure - * The string statuss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_statuss_increase_by_ - extern f_status_t f_statuss_increase_by(const f_number_unsigned_t amount, f_statuss_t * const structure); -#endif // _di_f_statuss_increase_by_ - -/** - * Resize the string statuss array. - * - * @param length - * The new size to use. - * @param structure - * The string statuss array to adjust. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_statuss_resize_ - extern f_status_t f_statuss_resize(const f_number_unsigned_t length, f_statuss_t * const structure); -#endif // _di_f_statuss_resize_ - -/** - * Resize the string statusss array. - * - * @param length - * The new size to use. - * @param structure - * The string statusss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_adjust(). - * - * @see f_memory_array_adjust() - */ -#ifndef _di_f_statusss_adjust_ - extern f_status_t f_statusss_adjust(const f_number_unsigned_t length, f_statusss_t * const structure); -#endif // _di_f_statusss_adjust_ - -/** - * Append the single source statuss onto the destination. - * - * @param source - * The source statuss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase(). - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase() - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_statusss_append_ - extern f_status_t f_statusss_append(const f_statuss_t source, f_statusss_t * const destination); -#endif // _di_f_statusss_append_ - -/** - * Append the source statusss onto the destination. - * - * @param source - * The source statusss to append. - * @param destination - * The destination ranges the source is appended onto. - * - * @return - * F_none on success. - * F_data_not on success, but there is nothing to append (size == 0). - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_increase_by(). - * - * @see f_memory_array_increase_by() - */ -#ifndef _di_f_statusss_append_all_ - extern f_status_t f_statusss_append_all(const f_statusss_t source, f_statusss_t * const destination); -#endif // _di_f_statusss_append_all_ - -/** - * Resize the string statusss array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decimate the size by. - * @param structure - * The string statusss array to resize. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -295,97 +37,24 @@ extern "C" { * Errors (with error bit) from: f_memory_array_adjust(). * * @see f_memory_array_adjust() + * @see f_memory_arrays_adjust() */ -#ifndef _di_f_statusss_decimate_by_ - extern f_status_t f_statusss_decimate_by(const f_number_unsigned_t amount, f_statusss_t * const structure); -#endif // _di_f_statusss_decimate_by_ - -/** - * Resize the string statusss array to a smaller size. - * - * This will resize making the array smaller based on (size - given length). - * If the given length is too small, then the resize will fail. - * This will not shrink the size to less than 0. - * - * @param amount - * A positive number representing how much to decrease the size by. - * @param structure - * The string statusss array to resize. - * - * @return - * F_none on success. - * - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_statusss_decrease_by_ - extern f_status_t f_statusss_decrease_by(const f_number_unsigned_t amount, f_statusss_t * const structure); -#endif // _di_f_statusss_decrease_by_ +#ifndef _di_f_statuss_adjust_callback_ + extern f_status_t f_statuss_adjust_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_statuss_adjust_callback_ /** - * Increase the size of the string statusss array, but only if necessary. - * - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. + * A callback intended to be passed to f_memory_arrays_resize() for an f_statusss_t structure. * - * @param step - * The allocation step to use. - * Must be greater than 0. - * @param structure - * The string statusss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + 1 <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_statusss_increase_ - extern f_status_t f_statusss_increase(const f_number_unsigned_t step, f_statusss_t * const structure); -#endif // _di_f_statusss_increase_ - -/** - * Resize the string statusss array to a larger size. - * - * This will resize making the array larger based on the given length. - * If the given length is too large for the buffer, then attempt to set max buffer size (F_number_t_size_unsigned_d). - * If already set to the maximum buffer size, then the resize will fail. - * - * @param amount - * A positive number representing how much to increase the size by. - * @param structure - * The string statusss array to resize. - * - * @return - * F_none on success. - * F_data_not on success, but there is no reason to increase size (used + amount <= size). - * - * F_array_too_large (with error bit) if the new array length is too large. - * F_parameter (with error bit) if a parameter is invalid. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - */ -#ifndef _di_f_statusss_increase_by_ - extern f_status_t f_statusss_increase_by(const f_number_unsigned_t amount, f_statusss_t * const structure); -#endif // _di_f_statusss_increase_by_ - -/** - * Resize the string statusss array. + * This does not do parameter checking. * - * @param length - * The new size to use. - * @param structure - * The string statusss array to adjust. + * @param start + * The start position in the array to start deleting. + * @param stop + * The stop in the array to stop deleting. + * @param array + * The array structure to delete all values of. + * Must not be NULL. * * @return * F_none on success. @@ -395,10 +64,11 @@ extern "C" { * Errors (with error bit) from: f_memory_array_resize(). * * @see f_memory_array_resize() + * @see f_memory_arrays_resize() */ -#ifndef _di_f_statusss_resize_ - extern f_status_t f_statusss_resize(const f_number_unsigned_t length, f_statusss_t * const structure); -#endif // _di_f_statusss_resize_ +#ifndef _di_f_statuss_resize_callback_ + extern f_status_t f_statuss_resize_callback(const f_number_unsigned_t start, const f_number_unsigned_t size, void * const array); +#endif // _di_f_statuss_resize_callback_ #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_type_array/data/build/settings b/level_0/f_type_array/data/build/settings index 2120017..47f7c15 100644 --- a/level_0/f_type_array/data/build/settings +++ b/level_0/f_type_array/data/build/settings @@ -33,7 +33,6 @@ build_libraries -lc build_libraries-individual -lf_memory build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_unsigned.c type_array/poll.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c -build_sources_library type_array/private-poll.c type_array/private-state.c type_array/private-status.c build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_unsigned.h type_array/poll.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h diff --git a/level_0/f_type_array/data/build/settings-mocks b/level_0/f_type_array/data/build/settings-mocks index ba10b19..46c80ed 100644 --- a/level_0/f_type_array/data/build/settings-mocks +++ b/level_0/f_type_array/data/build/settings-mocks @@ -31,7 +31,6 @@ build_libraries -lc build_libraries-individual -lf_memory build_sources_library type_array/cell.c type_array/file.c type_array/fll_id.c type_array/int8.c type_array/int16.c type_array/int32.c type_array/int64.c type_array/int128.c type_array/number_unsigned.c type_array/poll.c type_array/state.c type_array/status.c type_array/uint8.c type_array/uint16.c type_array/uint32.c type_array/uint64.c type_array/uint128.c -build_sources_library type_array/private-poll.c type_array/private-state.c type_array/private-status.c build_sources_library ../../tests/unit/c/mock-type_array.c build_sources_headers type_array.h type_array_file.h type_array/common.h type_array/cell.h type_array/file.h type_array/fll_id.h type_array/int8.h type_array/int16.h type_array/int32.h type_array/int64.h type_array/int128.h type_array/number_unsigned.h type_array/poll.h type_array/state.h type_array/status.h type_array/uint8.h type_array/uint16.h type_array/uint32.h type_array/uint64.h type_array/uint128.h diff --git a/level_0/f_type_array/data/build/settings-tests b/level_0/f_type_array/data/build/settings-tests index 7f3fd2b..6fb52f6 100644 --- a/level_0/f_type_array/data/build/settings-tests +++ b/level_0/f_type_array/data/build/settings-tests @@ -32,6 +32,9 @@ build_sources_program test-type_array-int32s_adjust_callback.c test-type_array-i build_sources_program test-type_array-int64s_adjust_callback.c test-type_array-int64s_resize_callback.c build_sources_program test-type_array-int128s_adjust_callback.c test-type_array-int128s_resize_callback.c build_sources_program test-type_array-number_unsigneds_adjust_callback.c test-type_array-number_unsigneds_resize_callback.c +build_sources_program test-type_array-polls_adjust_callback.c test-type_array-polls_resize_callback.c +build_sources_program test-type_array-states_adjust_callback.c test-type_array-states_resize_callback.c +build_sources_program test-type_array-statuss_adjust_callback.c test-type_array-statuss_resize_callback.c build_sources_program test-type_array-uint8s_adjust_callback.c test-type_array-uint8s_resize_callback.c build_sources_program test-type_array-uint16s_adjust_callback.c test-type_array-uint16s_resize_callback.c build_sources_program test-type_array-uint32s_adjust_callback.c test-type_array-uint32s_resize_callback.c diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.c new file mode 100644 index 0000000..7147391 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-polls_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_polls_adjust_callback__fails(void **state) { + + f_poll_t data = f_poll_t_initialize; + f_poll_t data_array[] = { data }; + f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_polls_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_polls_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_polls_adjust_callback__works(void **state) { + + f_poll_t data = f_poll_t_initialize; + f_poll_t data_array[] = { data }; + f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_polls_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_polls_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.h new file mode 100644 index 0000000..998643a --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-polls_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__polls_adjust_callback +#define _TEST__F_type_array__polls_adjust_callback + +/** + * Test that the function fails. + * + * @see f_polls_adjust_callback() + */ +extern void test__f_type_array_polls_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_polls_adjust_callback() + */ +extern void test__f_type_array_polls_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__polls_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.c new file mode 100644 index 0000000..8962386 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-polls_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_polls_resize_callback__fails(void **state) { + + f_poll_t data = f_poll_t_initialize; + f_poll_t data_array[] = { data }; + f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_polls_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_polls_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_polls_resize_callback__works(void **state) { + + f_poll_t data = f_poll_t_initialize; + f_poll_t data_array[] = { data }; + f_polls_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_polls_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_polls_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.h new file mode 100644 index 0000000..92d064b --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-polls_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__polls_resize_callback +#define _TEST__F_type_array__polls_resize_callback + +/** + * Test that the function fails. + * + * @see f_polls_resize_callback() + */ +extern void test__f_type_array_polls_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_polls_resize_callback() + */ +extern void test__f_type_array_polls_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__polls_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.c new file mode 100644 index 0000000..d58efaa --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-states_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_adjust_callback__fails(void **state) { + + f_state_t data = f_state_t_initialize; + f_state_t data_array[] = { data }; + f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_states_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_states_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_states_adjust_callback__works(void **state) { + + f_state_t data = f_state_t_initialize; + f_state_t data_array[] = { data }; + f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_states_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_states_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.h new file mode 100644 index 0000000..2b77be3 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__states_adjust_callback +#define _TEST__F_type_array__states_adjust_callback + +/** + * Test that the function fails. + * + * @see f_states_adjust_callback() + */ +extern void test__f_type_array_states_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_states_adjust_callback() + */ +extern void test__f_type_array_states_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__states_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.c new file mode 100644 index 0000000..5e8ff10 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-states_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_states_resize_callback__fails(void **state) { + + f_state_t data = f_state_t_initialize; + f_state_t data_array[] = { data }; + f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_states_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_states_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_states_resize_callback__works(void **state) { + + f_state_t data = f_state_t_initialize; + f_state_t data_array[] = { data }; + f_states_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_states_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_states_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.h new file mode 100644 index 0000000..7bead77 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-states_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__states_resize_callback +#define _TEST__F_type_array__states_resize_callback + +/** + * Test that the function fails. + * + * @see f_states_resize_callback() + */ +extern void test__f_type_array_states_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_states_resize_callback() + */ +extern void test__f_type_array_states_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__states_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.c new file mode 100644 index 0000000..535d842 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_adjust_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_adjust_callback__fails(void **state) { + + f_status_t data = f_status_t_initialize; + f_status_t data_array[] = { data }; + f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_statuss_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_adjust, true); + will_return(__wrap_f_memory_array_adjust, F_status_set_error(F_failure)); + + const f_status_t status = f_statuss_adjust_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_statuss_adjust_callback__works(void **state) { + + f_status_t data = f_status_t_initialize; + f_status_t data_array[] = { data }; + f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_statuss_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_adjust, false); + will_return(__wrap_f_memory_array_adjust, F_none); + + const f_status_t status = f_statuss_adjust_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.h new file mode 100644 index 0000000..8f00dc9 --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_adjust_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__statuss_adjust_callback +#define _TEST__F_type_array__statuss_adjust_callback + +/** + * Test that the function fails. + * + * @see f_statuss_adjust_callback() + */ +extern void test__f_type_array_statuss_adjust_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_statuss_adjust_callback() + */ +extern void test__f_type_array_statuss_adjust_callback__works(void **state); + +#endif // _TEST__F_type_array__statuss_adjust_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.c b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.c new file mode 100644 index 0000000..e7de32f --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.c @@ -0,0 +1,45 @@ +#include "test-type_array.h" +#include "test-type_array-statuss_resize_callback.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void test__f_type_array_statuss_resize_callback__fails(void **state) { + + f_status_t data = f_status_t_initialize; + f_status_t data_array[] = { data }; + f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_statuss_t datass_array[] = { datas }; + + { + will_return(__wrap_f_memory_array_resize, true); + will_return(__wrap_f_memory_array_resize, F_status_set_error(F_failure)); + + const f_status_t status = f_statuss_resize_callback(0, 1, (void *) datass_array); + + assert_int_equal(status, F_status_set_error(F_failure)); + } +} + +void test__f_type_array_statuss_resize_callback__works(void **state) { + + f_status_t data = f_status_t_initialize; + f_status_t data_array[] = { data }; + f_statuss_t datas = { .array = data_array, .used = 1, .size = 1 }; + f_statuss_t datass_array[] = { datas }; + const f_number_unsigned_t length = 1; + + { + will_return(__wrap_f_memory_array_resize, false); + will_return(__wrap_f_memory_array_resize, F_none); + + const f_status_t status = f_statuss_resize_callback(0, length, (void *) datass_array); + + assert_int_equal(status, F_none); + } +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.h b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.h new file mode 100644 index 0000000..52ae5fc --- /dev/null +++ b/level_0/f_type_array/tests/unit/c/test-type_array-statuss_resize_callback.h @@ -0,0 +1,27 @@ +/** + * FLL - Level 0 + * + * Project: Type + * API Version: 0.7 + * Licenses: lgpl-2.1-or-later + * + * Test the array types in the type project. + */ +#ifndef _TEST__F_type_array__statuss_resize_callback +#define _TEST__F_type_array__statuss_resize_callback + +/** + * Test that the function fails. + * + * @see f_statuss_resize_callback() + */ +extern void test__f_type_array_statuss_resize_callback__fails(void **state); + +/** + * Test that the function works. + * + * @see f_statuss_resize_callback() + */ +extern void test__f_type_array_statuss_resize_callback__works(void **state); + +#endif // _TEST__F_type_array__statuss_resize_callback diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.c b/level_0/f_type_array/tests/unit/c/test-type_array.c index 79dab2c..2d357ff 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.c +++ b/level_0/f_type_array/tests/unit/c/test-type_array.c @@ -44,6 +44,15 @@ int main(void) { cmocka_unit_test(test__f_type_array_number_unsigneds_adjust_callback__fails), cmocka_unit_test(test__f_type_array_number_unsigneds_resize_callback__fails), + cmocka_unit_test(test__f_type_array_polls_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_polls_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_states_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_states_resize_callback__fails), + + cmocka_unit_test(test__f_type_array_statuss_adjust_callback__fails), + cmocka_unit_test(test__f_type_array_statuss_resize_callback__fails), + cmocka_unit_test(test__f_type_array_uint8s_adjust_callback__fails), cmocka_unit_test(test__f_type_array_uint8s_resize_callback__fails), @@ -86,6 +95,15 @@ int main(void) { cmocka_unit_test(test__f_type_array_number_unsigneds_adjust_callback__works), cmocka_unit_test(test__f_type_array_number_unsigneds_resize_callback__works), + cmocka_unit_test(test__f_type_array_polls_adjust_callback__works), + cmocka_unit_test(test__f_type_array_polls_resize_callback__works), + + cmocka_unit_test(test__f_type_array_states_adjust_callback__works), + cmocka_unit_test(test__f_type_array_states_resize_callback__works), + + cmocka_unit_test(test__f_type_array_statuss_adjust_callback__works), + cmocka_unit_test(test__f_type_array_statuss_resize_callback__works), + cmocka_unit_test(test__f_type_array_uint8s_adjust_callback__works), cmocka_unit_test(test__f_type_array_uint8s_resize_callback__works), @@ -129,6 +147,15 @@ int main(void) { // f_number_unsigneds_adjust_callback() doesn't use parameter checking. // f_number_unsigneds_resize_callback() doesn't use parameter checking. + // f_polls_adjust_callback() doesn't use parameter checking. + // f_polls_resize_callback() doesn't use parameter checking. + + // f_states_adjust_callback() doesn't use parameter checking. + // f_states_resize_callback() doesn't use parameter checking. + + // f_statuss_adjust_callback() doesn't use parameter checking. + // f_statuss_resize_callback() doesn't use parameter checking. + // f_uint8s_adjust_callback() doesn't use parameter checking. // f_uint8s_resize_callback() doesn't use parameter checking. diff --git a/level_0/f_type_array/tests/unit/c/test-type_array.h b/level_0/f_type_array/tests/unit/c/test-type_array.h index fa5e2d0..c39bec7 100644 --- a/level_0/f_type_array/tests/unit/c/test-type_array.h +++ b/level_0/f_type_array/tests/unit/c/test-type_array.h @@ -45,6 +45,12 @@ #include "test-type_array-int128s_resize_callback.h" #include "test-type_array-number_unsigneds_adjust_callback.h" #include "test-type_array-number_unsigneds_resize_callback.h" +#include "test-type_array-polls_adjust_callback.h" +#include "test-type_array-polls_resize_callback.h" +#include "test-type_array-states_adjust_callback.h" +#include "test-type_array-states_resize_callback.h" +#include "test-type_array-statuss_adjust_callback.h" +#include "test-type_array-statuss_resize_callback.h" #include "test-type_array-uint8s_adjust_callback.h" #include "test-type_array-uint8s_resize_callback.h" #include "test-type_array-uint16s_adjust_callback.h" -- 1.8.3.1