]> Kevux Git Server - fll/commitdiff
Progress: Continue memory array related changes.
authorKevin Day <kevin@kevux.org>
Fri, 21 Jul 2023 03:10:39 +0000 (22:10 -0500)
committerKevin Day <kevin@kevux.org>
Fri, 21 Jul 2023 03:10:39 +0000 (22:10 -0500)
This converts a lot of the projects to use the f_memory_array_*() functions.

Break the f_thread private functions into their own files.

112 files changed:
build/level_0/settings
build/monolithic/settings
build/stand_alone/fake.config.h
build/stand_alone/fake.settings
level_0/f_fss/c/fss/nest.c
level_0/f_fss/c/fss/private-item.c
level_0/f_fss/c/fss/private-item.h
level_0/f_fss/c/fss/private-named.c
level_0/f_fss/c/fss/private-named.h
level_0/f_fss/c/fss/private-nest.c
level_0/f_fss/c/fss/private-nest.h
level_0/f_fss/c/fss/private-set.c
level_0/f_fss/c/fss/private-set.h
level_0/f_fss/c/fss/private-set_quote.c
level_0/f_fss/c/fss/private-set_quote.h
level_0/f_fss/c/fss/simple_packet.c
level_0/f_fss/c/fss/simple_packet.h
level_0/f_limit/c/limit/set.c
level_0/f_limit/c/limit/set.h
level_0/f_limit/c/limit/value.c
level_0/f_limit/c/limit/value.h
level_0/f_socket/c/socket/private-socket.c
level_0/f_socket/c/socket/private-socket.h
level_0/f_socket/c/socket/socket.c
level_0/f_string/c/private-string.c
level_0/f_string/c/string.c
level_0/f_string/c/string/dynamic.c
level_0/f_string/c/string/dynamics.c
level_0/f_string/c/string/dynamicss.c
level_0/f_string/c/string/map_multis.c
level_0/f_string/c/string/map_multiss.c
level_0/f_string/c/string/maps.c
level_0/f_string/c/string/mapss.c
level_0/f_string/c/string/private-dynamic.c
level_0/f_string/c/string/private-dynamic.h
level_0/f_string/c/string/private-dynamics.c
level_0/f_string/c/string/private-dynamics.h
level_0/f_string/c/string/private-dynamicss.c
level_0/f_string/c/string/private-dynamicss.h
level_0/f_string/c/string/private-map_multis.c
level_0/f_string/c/string/private-map_multis.h
level_0/f_string/c/string/private-map_multiss.c
level_0/f_string/c/string/private-maps.c
level_0/f_string/c/string/private-maps.h
level_0/f_string/c/string/private-mapss.c
level_0/f_string/c/string/private-mapss.h
level_0/f_string/c/string/private-quantitys.c
level_0/f_string/c/string/private-quantitys.h
level_0/f_string/c/string/private-quantityss.c
level_0/f_string/c/string/private-quantityss.h
level_0/f_string/c/string/private-ranges.c
level_0/f_string/c/string/private-ranges.h
level_0/f_string/c/string/private-rangess.c
level_0/f_string/c/string/private-triples.c
level_0/f_string/c/string/private-triples.h
level_0/f_string/c/string/private-tripless.c
level_0/f_string/c/string/quantitys.c
level_0/f_string/c/string/quantityss.c
level_0/f_string/c/string/ranges.c
level_0/f_string/c/string/rangess.c
level_0/f_string/c/string/triples.c
level_0/f_string/c/string/tripless.c
level_0/f_thread/c/private-thread.c [deleted file]
level_0/f_thread/c/private-thread.h [deleted file]
level_0/f_thread/c/thread.c
level_0/f_thread/c/thread/attribute.c
level_0/f_thread/c/thread/barrier.c
level_0/f_thread/c/thread/barrier_attribute.c
level_0/f_thread/c/thread/condition.c
level_0/f_thread/c/thread/condition_attribute.c
level_0/f_thread/c/thread/id.c
level_0/f_thread/c/thread/key.c
level_0/f_thread/c/thread/lock.c
level_0/f_thread/c/thread/lock_attribute.c
level_0/f_thread/c/thread/mutex.c
level_0/f_thread/c/thread/mutex_attribute.c
level_0/f_thread/c/thread/once.c
level_0/f_thread/c/thread/private-attribute.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-attribute.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-barrier.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-barrier.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-barrier_attribute.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-barrier_attribute.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-condition.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-condition.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-condition_attribute.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-condition_attribute.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-id.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-id.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-key.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-key.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-lock.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-lock.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-lock_attribute.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-lock_attribute.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-mutex.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-mutex.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-mutex_attribute.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-mutex_attribute.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-once.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-once.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-semaphore.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-semaphore.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-set.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-set.h [new file with mode: 0644]
level_0/f_thread/c/thread/private-spin.c [new file with mode: 0644]
level_0/f_thread/c/thread/private-spin.h [new file with mode: 0644]
level_0/f_thread/c/thread/semaphore.c
level_0/f_thread/c/thread/set.c
level_0/f_thread/c/thread/spin.c
level_0/f_thread/data/build/settings
level_0/f_thread/data/build/settings-mocks

index 520533cf8d5c62683b507795bd90ee57cf9a2482..38effe03d224143a0b52c6cca94bdcb2057bfd32 100644 (file)
@@ -91,7 +91,8 @@ build_sources_library utf/private-map_multis.c utf/private-map_multiss.c
 build_sources_library utf/private-string.c
 build_sources_library utf/private-triples.c utf/private-tripless.c
 
-build_sources_library-thread thread.c private-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.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_headers account.h account/accounts.h account/common.h
 build_sources_headers capability.h capability/common.h
index fef20f62de9a07ffaf95e8c1c8cf86b37cd02c61..ae95a173928414dd7a95aa8b45e2cf091b7967aa 100644 (file)
@@ -113,7 +113,8 @@ build_sources_library level_2/iki.c level_2/private-iki.c
 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/private-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.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_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
index 52bea4752b622a2dddbd5d0ed3203e6c3bb59864..4637fa3f4f9779d3330902472f2c511fda40208d 100644 (file)
 #define _di_f_memory_array_adjust_
 #define _di_f_memory_array_decimate_by_
 #define _di_f_memory_array_decrease_by_
-#define _di_f_memory_array_increase_
-#define _di_f_memory_array_increase_by_
+//#define _di_f_memory_array_increase_
+//#define _di_f_memory_array_increase_by_
 //#define _di_f_memory_array_resize_
 //#define _di_f_memory_default_d_
 //#define _di_f_memory_delete_
index 5aff6fea8fc89cc03010fd30c440300cc6f06401..6eb23f94db597e5a34404710cf8a6e93dbd5f374 100644 (file)
@@ -62,7 +62,8 @@ build_sources_program fll/level_0/utf.c fll/level_0/private-utf.c fll/level_0/pr
 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/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-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 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
index 94f20858f104f89abd770e112e60128222083f3e..0741acaded6de4fe1c1b76301c5563eb97e1caaa 100644 (file)
@@ -113,9 +113,8 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!amount) return F_data_not;
-    if (nests->size > amount) return private_f_fss_nests_adjust(nests->size - amount, nests);
 
-    return private_f_fss_nests_adjust(0, nests);
+    return private_f_fss_nests_adjust((nests->size > amount) ? nests->size - amount : 0, nests);
   }
 #endif // _di_f_fss_nests_decimate_by_
 
@@ -126,9 +125,8 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!amount) return F_data_not;
-    if (nests->size > amount) return private_f_fss_nests_resize(nests->size - amount, nests);
 
-    return private_f_fss_nests_resize(0, nests);
+    return private_f_fss_nests_resize((nests->size > amount) ? nests->size - amount : 0, nests);
   }
 #endif // _di_f_fss_nests_decrease_by_
 
index ab78342963be598803e8e6ce0df22804e16ff0e3..023da0ac09bf312d289665326863611762f8ea37 100644 (file)
@@ -5,7 +5,7 @@
 extern "C" {
 #endif
 
-#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_)
+#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) || !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_)
   f_status_t private_f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) {
 
     f_status_t status = F_none;
@@ -18,9 +18,9 @@ extern "C" {
 
     return f_memory_array_adjust(length, sizeof(f_fss_item_t), (void **) &items->array, &items->used, &items->size);
   }
-#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_)
+#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) || !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_)
 
-#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_)
+#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_resize_) || !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_resize_)
   f_status_t private_f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) {
 
     f_status_t status = F_none;
@@ -33,7 +33,7 @@ extern "C" {
 
     return f_memory_array_resize(length, sizeof(f_fss_item_t), (void **) &items->array, &items->used, &items->size);
   }
-#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_increase_) || !defined(_di_f_fss_items_increase_by_) || !defined(_di_f_fss_items_resize_)
+#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_resize_) || !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_resize_)
 
 #ifdef __cplusplus
 } // extern "C"
index 2435605a7374611fe399af447d8d461677e01a49..6e469996728fe5f26e6ad043a58bbd094d8cc083 100644 (file)
@@ -35,10 +35,15 @@ extern "C" {
  *
  * @see f_memory_array_adjust()
  * @see f_string_dynamic_adjust()
+ *
+ * @see f_fss_items_adjust()
+ * @see f_fss_items_decimate_by()
+ * @see f_fss_nest_adjust()
+ * @see f_fss_nest_decimate_by()
  */
-#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_)
+#if !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) || !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_)
   extern f_status_t private_f_fss_items_adjust(const f_number_unsigned_t length, f_fss_items_t * const items) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_)
+#endif // !defined(_di_f_fss_items_adjust_) || !defined(_di_f_fss_items_decimate_by_) || !defined(_di_f_fss_nest_adjust_) || !defined(_di_f_fss_nest_decimate_by_)
 
 /**
  * Private implementation for resizing.
@@ -60,10 +65,15 @@ extern "C" {
  *
  * @see f_memory_array_resize()
  * @see f_string_dynamic_resize()
+ *
+ * @see f_fss_items_decrease_by()
+ * @see f_fss_items_resize()
+ * @see f_fss_nest_decrease_by()
+ * @see f_fss_nest_resize()
  */
-#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_resize_)
+#if !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_resize_) || !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_resize_)
   extern f_status_t private_f_fss_items_resize(const f_number_unsigned_t length, f_fss_items_t * const items) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_resize_)
+#endif // !defined(_di_f_fss_items_decrease_by_) || !defined(_di_f_fss_items_resize_) || !defined(_di_f_fss_nest_decrease_by_) || !defined(_di_f_fss_nest_resize_)
 
 #ifdef __cplusplus
 } // extern "C"
index bfa04a32b3e07e3744d040f2626bbd76735cca00..2f20422534443cafc2fdef7e739a7d1ef6fb7f67 100644 (file)
@@ -21,7 +21,7 @@ extern "C" {
   }
 #endif // !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_)
 
-#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_resize_)
+#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_named_increase_) || !defined(_di_f_fss_named_increase_by_) || !defined(_di_f_fss_nameds_resize_)
   f_status_t private_f_fss_named_resize(const f_number_unsigned_t length, f_fss_named_t * const named) {
 
     f_status_t status = f_string_ranges_resize(length, &named->objects);
@@ -35,7 +35,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_resize_)
+#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_named_increase_) || !defined(_di_f_fss_named_increase_by_) || !defined(_di_f_fss_nameds_resize_)
 
 #if !defined(_di_f_fss_nameds_adjust_) || !defined(_di_f_fss_nameds_decimate_by_)
   f_status_t private_f_fss_nameds_adjust(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) {
index 6d1f48c5788de3411785d5174b83afbb0cc36abd..ee29923ffbdf9d1b09989009a0d8feae3ae7ea44 100644 (file)
@@ -129,11 +129,13 @@ extern "C" {
  * @see f_uint8ss_resize()
  *
  * @see f_fss_nameds_decrease_by()
+ * @see f_fss_nameds_increase()
+ * @see f_fss_nameds_increase_by()
  * @see f_fss_nameds_resize()
  */
-#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_resize_)
+#if !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_named_increase_) || !defined(_di_f_fss_named_increase_by_) || !defined(_di_f_fss_nameds_resize_)
   extern f_status_t private_f_fss_nameds_resize(const f_number_unsigned_t length, f_fss_nameds_t * const nameds) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_nameds_resize_)
+#endif // !defined(_di_f_fss_nameds_decrease_by_) || !defined(_di_f_fss_named_increase_) || !defined(_di_f_fss_named_increase_by_) || !defined(_di_f_fss_nameds_resize_)
 
 #ifdef __cplusplus
 } // extern "C"
index bf50fc99e7e5367dd261cd508182b7933e70d200..a85fbbb2b81836aebfbaaf4f3750972d99650ae3 100644 (file)
@@ -57,7 +57,7 @@ extern "C" {
   }
 #endif // !defined(_di_f_fss_nests_adjust_) || !defined(_di_f_fss_nests_decimate_by_)
 
-#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_resize_)
+#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_)
   f_status_t private_f_fss_nests_resize(const f_number_unsigned_t length, f_fss_nests_t * const nests) {
 
     {
@@ -72,7 +72,7 @@ extern "C" {
 
     return f_memory_array_resize(length, sizeof(f_fss_nest_t), (void **) &nests->array, &nests->used, &nests->size);
   }
-#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_resize_)
+#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_)
 
 #ifdef __cplusplus
 } // extern "C"
index 78cd408cf09a1aa49d03f13d05ae415962799455..a3e83617206f5373b8441b2d91e5cabdbf1d7efc 100644 (file)
@@ -121,11 +121,13 @@ extern "C" {
  * @see f_string_dynamic_resize()
  *
  * @see f_fss_nests_decrease_by()
+ * @see f_fss_nests_increase()
+ * @see f_fss_nests_increase_by()
  * @see f_fss_nests_resize()
  */
-#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_resize_)
+#if !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_)
   extern f_status_t private_f_fss_nests_resize(const f_number_unsigned_t length, f_fss_nests_t * const nests) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_resize_)
+#endif // !defined(_di_f_fss_nests_decrease_by_) || !defined(_di_f_fss_nests_increase_) || !defined(_di_f_fss_nests_increase_by_) || !defined(_di_f_fss_nests_resize_)
 
 #ifdef __cplusplus
 } // extern "C"
index 067a2aef5b3ecf2f5433e80f6feeb9ad0a3f2cf7..2949ff65d19795e09413f26262f83a840bfe7f6a 100644 (file)
@@ -18,7 +18,7 @@ extern "C" {
   }
 #endif // !defined(_di_f_fss_set_adjust_) || !defined(_di_f_fss_set_decimate_by_)
 
-#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_resize_)
+#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_)
   f_status_t private_f_fss_set_resize(const f_number_unsigned_t length, f_fss_set_t *set) {
 
     f_status_t status = f_string_ranges_resize(length, &set->objects);
@@ -29,7 +29,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_resize_)
+#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_)
 
 #if !defined(_di_f_fss_sets_adjust_) || !defined(_di_f_fss_sets_decimate_by_)
   f_status_t private_f_fss_sets_adjust(const f_number_unsigned_t length, f_fss_sets_t * const sets) {
index 82b37815349514e3434f2ab815fa2da12ee8f487..5250ae56fc39fa3819a77751c06ac6e4342ef55a 100644 (file)
@@ -61,11 +61,13 @@ extern "C" {
  * @see f_string_rangess_resize()()
  *
  * @see f_fss_set_decrease_by()
+ * @see f_fss_set_increase()
+ * @see f_fss_set_increase_by()
  * @see f_fss_set_resize()
  */
-#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_resize_)
+#if !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_)
   extern f_status_t private_f_fss_set_resize(const f_number_unsigned_t length, f_fss_set_t * const set) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_resize_)
+#endif // !defined(_di_f_fss_set_decrease_by_) || !defined(_di_f_fss_set_increase_) || !defined(_di_f_fss_set_increase_by_) || !defined(_di_f_fss_set_resize_)
 
 /**
  * Private implementation for resizing.
index 3324f434b1652170bb37d3ae04e269f98ca1e5ce..d955e87941173c17a3a7e0ed4566cbc4cc1f7abb 100644 (file)
@@ -24,7 +24,7 @@ extern "C" {
   }
 #endif // !defined(_di_f_fss_set_quote_adjust_) || !defined(_di_f_fss_set_quote_decimate_by_)
 
-#if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_resize_)
+#if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_)
   f_status_t private_f_fss_set_quote_resize(const f_number_unsigned_t length, f_fss_set_quote_t * const set_quote) {
 
     f_status_t status = f_string_ranges_resize(length, &set_quote->objects);
@@ -41,7 +41,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_resize_)
+#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_)
 
 #if !defined(_di_f_fss_set_quotes_adjust_) || !defined(_di_f_fss_set_quotes_decimate_by_)
   f_status_t private_f_fss_set_quotes_adjust(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) {
index dd693079f1408ebc2e5c72a90bbf1d0d13c0069d..0c9bec68bf802ac5bd0d8760045740b03096aae5 100644 (file)
@@ -138,12 +138,14 @@ extern "C" {
  * @see f_uint8ss_adjust()
  *
  * @see f_fss_set_quotes_decrease_by()
+ * @see f_fss_set_quotes_increase()
+ * @see f_fss_set_quotes_increase_by()
  * @see f_fss_set_quotes_resize()
  * @see f_memory_resize()
  */
-#if !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_resize_)
+#if !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_)
   extern f_status_t private_f_fss_set_quotes_resize(const f_number_unsigned_t length, f_fss_set_quotes_t * const set_quotes) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_fss_set_quotes_decrease_by_) || !defined(_di_f_fss_set_quotes_resize_)
+#endif // !defined(_di_f_fss_set_quote_decrease_by_) || !defined(_di_f_fss_set_quote_increase_) || !defined(_di_f_fss_set_quote_increase_by_) || !defined(_di_f_fss_set_quote_resize_)
 
 #ifdef __cplusplus
 } // extern "C"
index d7ec68f31d383a1a88e5e1a96b7eee11fa088c75..4f02106acf69c05c467bf49978ea670b77724e94 100644 (file)
@@ -177,7 +177,7 @@ extern "C" {
 
     if (!source.used) return F_data_not;
 
-    f_status_t status = f_memory_array_increase(source.used, sizeof(f_fss_simple_packet_ranges_t), (void **) &destination->array, &destination->used, &destination->size);
+    f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_fss_simple_packet_ranges_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) {
index ec447d9137b23a0a7d9b72d37e2cee3e509f563f..22024d7479be116612dfe6f6a45a1e3df8a14ed3 100644 (file)
@@ -188,10 +188,10 @@ extern "C" {
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: f_memory_array_increase_by().
+ *   Errors (with error bit) from: f_memory_array_increase().
  *   Errors (with error bit) from: f_memory_array_resize().
  *
- * @see f_memory_array_increase_by()
+ * @see f_memory_array_increase()
  * @see f_memory_array_resize()
  */
 #ifndef _di_f_fss_simple_packet_ranges_append_
index 1e78b7712a6cbcf9fdce3555a82ee24ba96f810f..ac187d54775c2ab262361b6422e4320b43caedd9 100644 (file)
@@ -126,7 +126,7 @@ extern "C" {
 
     if (!source.used) return F_data_not;
 
-    f_status_t status = f_memory_array_increase(source.used, sizeof(f_limit_sets_t), (void **) &destination->array, &destination->used, &destination->size);
+    f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_limit_sets_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) {
index e32eadd0051e0f5b011aeade3b7d65914cb5c6aa..d96d757e26bc52cedb6e4ac077aec08032219b9d 100644 (file)
@@ -336,10 +336,10 @@ extern "C" {
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: f_memory_array_increase_by().
+ *   Errors (with error bit) from: f_memory_array_increase().
  *   Errors (with error bit) from: f_memory_array_resize().
  *
- * @see f_memory_array_increase_by()
+ * @see f_memory_array_increase()
  * @see f_memory_array_resize()
  */
 #ifndef _di_f_limit_setss_append_
index f1e3d4c56c7216acf3ae5399bf18597e47bbf316..9792dd25887855a581d40e3e4f2c6a003cac4e43 100644 (file)
@@ -126,7 +126,7 @@ extern "C" {
 
     if (!source.used) return F_data_not;
 
-    f_status_t status = f_memory_array_increase(source.used, sizeof(f_limit_values_t), (void **) &destination->array, &destination->used, &destination->size);
+    f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_limit_values_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) {
index 9fd7419f19ece5b897972df545dbf710420e5e31..c0ad9b7a09b63a82254be820f67c376d802d0fa0 100644 (file)
@@ -331,10 +331,10 @@ extern "C" {
  *
  *   F_parameter (with error bit) if a parameter is invalid.
  *
- *   Errors (with error bit) from: f_memory_array_increase_by().
+ *   Errors (with error bit) from: f_memory_array_increase().
  *   Errors (with error bit) from: f_memory_array_resize().
  *
- * @see f_memory_array_increase_by()
+ * @see f_memory_array_increase()
  * @see f_memory_array_resize()
  */
 #ifndef _di_f_limit_valuess_append_
index ebf90a8a91b7b54124782ab84dd0dfd86960a923..5838eb20267776c87af040e13ced8ce89fd7e698 100644 (file)
@@ -5,19 +5,7 @@
 extern "C" {
 #endif
 
-#if !defined(_di_f_sockets_append_) || !defined(_di_f_socketss_append_)
-  extern f_status_t private_f_sockets_append(const f_socket_t source, f_sockets_t * const destination) {
-
-    const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_socket_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_sockets_append_) || !defined(_di_f_socketss_append_)
-
-#if !defined(_di_f_sockets_append_) || !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_all_)
+#if !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_) || !defined(_di_f_socketss_append_all_)
   extern f_status_t private_f_sockets_append_all(const f_sockets_t source, f_sockets_t * const destination) {
 
     const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_socket_t), (void **) &destination->array, &destination->used, &destination->size);
@@ -29,7 +17,7 @@ extern "C" {
 
     return F_none;
   }
-#endif // !defined(_di_f_sockets_append_) || !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_all_)
+#endif // !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_) || !defined(_di_f_socketss_append_all_)
 
 #if !defined(_di_f_socketss_adjust_) || !defined(_di_f_socketss_decimate_by_)
   f_status_t private_f_socketss_adjust(const f_number_unsigned_t length, f_socketss_t * const socketss) {
index d86d434a0e5f3a86e6cafb90979fe604d6f976ef..5aa0391917b74c372b10f952628ff64d55e7d0cf 100644 (file)
@@ -21,29 +21,6 @@ extern "C" {
  * Intended to be shared to each of the different implementation variations.
  *
  * @param source
- *   The source socket to append.
- * @param destination
- *   The destination lengths the source is appended onto.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- * @see f_sockets_append()
- * @see f_socketss_append()
- */
-#if !defined(_di_f_sockets_append_) || !defined(_di_f_socketss_append_)
-  extern f_status_t private_f_sockets_append(const f_socket_t source, f_sockets_t * const destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_sockets_append_) || !defined(_di_f_socketss_append_)
-
-/**
- * Private implementation for appending the socket array.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param source
  *   The source sockets to append.
  * @param destination
  *   The destination lengths the source is appended onto.
@@ -54,13 +31,14 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_resize().
  *
  * @see f_memory_resize()
+ *
  * @see f_sockets_append_all()
  * @see f_socketss_append()
  * @see f_socketss_append_all()
  */
-#if !defined(_di_f_sockets_append_) || !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_all_)
+#if !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_) || !defined(_di_f_socketss_append_all_)
   extern f_status_t private_f_sockets_append_all(const f_sockets_t source, f_sockets_t * const destination) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_sockets_append_) || !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_all_)
+#endif // !defined(_di_f_sockets_append_all_) || !defined(_di_f_socketss_append_) || !defined(_di_f_socketss_append_all_)
 
 /**
  * Private implementation for resizing the socketss array.
index 96076883e8d2578cb9960fa9a7652d37f8e9f537..a8d9eea1f257f3301f33a3ad0ef4513b57a098b6 100644 (file)
@@ -22,7 +22,12 @@ extern "C" {
       if (!destination) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_sockets_append(source, destination);
+    const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_socket_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 // _di_f_sockets_append_
 
index ea4572e99d74efaebef7825a0503cc8abad097ac..58080d570d82d3924decb0651c896d642b0a6054 100644 (file)
@@ -9,8 +9,8 @@ extern "C" {
 #if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_partial_mash_nulless_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_mish_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_triples_append_)
   f_status_t private_f_string_append(const f_string_t source, const f_number_unsigned_t length, f_string_dynamic_t * const destination) {
 
-    if (destination->used + length + 1 > destination->size) {
-      const f_status_t status = private_f_string_dynamic_increase_by(length + 1, destination);
+    {
+      const f_status_t status = f_memory_array_increase_by(length + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
@@ -25,8 +25,9 @@ extern "C" {
 #if !defined(_di_f_string_append_assure_nulless_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_assure_nulless_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_assure_nulless_) || !defined(_di_f_string_dynamic_partial_append_nulless_) || !defined(_di_f_string_dynamic_partial_mash_nulless_) || !defined(_di_f_string_mash_nulless_)
   f_status_t private_f_string_append_nulless(const f_string_t source, const f_number_unsigned_t length, f_string_dynamic_t * const destination) {
 
-    f_status_t status = F_none;
+    if (destination->used >= F_string_t_size_d) return F_status_set_error(F_string_too_large);
 
+    f_status_t status = F_none;
     f_number_unsigned_t i = 0;
     f_number_unsigned_t size = 0;
 
@@ -35,10 +36,10 @@ extern "C" {
       if (source[i]) ++size;
     } // for
 
-    if (destination->used + size + 1 > destination->size) {
-      status = private_f_string_dynamic_increase_by(size + 1, destination);
-      if (F_status_is_error(status)) return status;
-    }
+    if (size + 1 > F_string_t_size_d) return F_status_set_error(F_string_too_large);
+
+    status = f_memory_array_increase_by(size + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+    if (F_status_is_error(status)) return status;
 
     f_number_unsigned_t first = 0;
 
@@ -76,12 +77,11 @@ extern "C" {
 #if !defined(_di_f_string_dynamic_mish_) || !defined(_di_f_string_dynamic_partial_mish_) || !defined(_di_f_string_dynamic_partial_prepend_assure_) || !defined(_di_f_string_dynamic_partial_prepend_) || !defined(_di_f_string_dynamic_prepend_assure_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_mish_) || !defined(_di_f_string_prepend_assure_) || !defined(_di_f_string_prepend_)
   f_status_t private_f_string_prepend(const f_string_t source, const f_number_unsigned_t length, f_string_dynamic_t * const destination) {
 
-    if (destination->used + length > F_string_t_size_d) {
-      return F_status_set_error(F_string_too_large);
-    }
+    if (destination->used >= F_string_t_size_d) return F_status_set_error(F_string_too_large);
+    if (destination->used + length + 1 > F_string_t_size_d) return F_status_set_error(F_string_too_large);
 
-    if (destination->used + length > destination->size) {
-      const f_status_t status = private_f_string_dynamic_increase_by(length, destination);
+    {
+      const f_status_t status = f_memory_array_increase_by(length + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
@@ -102,12 +102,9 @@ extern "C" {
 #if !defined(_di_f_string_dynamic_mish_nulless_) || !defined(_di_f_string_dynamic_partial_mish_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_partial_prepend_nulless_) || !defined(_di_f_string_dynamic_prepend_assure_nulless_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_mish_nulless_) || !defined(_di_f_string_prepend_assure_nulless_) || !defined(_di_f_string_prepend_nulless_)
   f_status_t private_f_string_prepend_nulless(const f_string_t source, const f_number_unsigned_t length, f_string_dynamic_t * const destination) {
 
-    if (destination->used + length > F_string_t_size_d) {
-      return F_status_set_error(F_string_too_large);
-    }
+    if (destination->used + length > F_string_t_size_d) return F_status_set_error(F_string_too_large);
 
     f_status_t status = F_none;
-
     f_number_unsigned_t first = 0;
     f_number_unsigned_t offset = 0;
 
@@ -119,10 +116,8 @@ extern "C" {
         if (i > first) {
           size = i - first;
 
-          if (destination->used + size > destination->size) {
-            status = private_f_string_dynamic_increase_by(size, destination);
-            if (F_status_is_error(status)) return status;
-          }
+          status = f_memory_array_increase_by(size + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+          if (F_status_is_error(status)) return status;
 
           memmove(destination->string + offset + size, destination->string + offset, sizeof(f_char_t) * (destination->used - offset));
           memcpy(destination->string + offset, source + first, sizeof(f_char_t) * size);
@@ -139,10 +134,8 @@ extern "C" {
           if (i > first) {
             size = i - first;
 
-            if (destination->used + size > destination->size) {
-              status = private_f_string_dynamic_increase_by(size, destination);
-              if (F_status_is_error(status)) return status;
-            }
+            status = f_memory_array_increase_by(size + 1, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
+            if (F_status_is_error(status)) return status;
 
             memmove(destination->string + offset + size, destination->string + offset, sizeof(f_char_t) * (destination->used - offset));
             memcpy(destination->string + offset, source + first, sizeof(f_char_t) * size);
index 8115e9cbd5ba8b40402fb054cc09d1e3ca4c5421..20a94c20d20d16e7a434f1a60c6c494cef014938 100644 (file)
@@ -24,10 +24,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!length) return F_data_not;
-
-    if (destination->used < length) {
-      return private_f_string_append(source, length, destination);
-    }
+    if (destination->used < length) return private_f_string_append(source, length, destination);
 
     f_number_unsigned_t i = 1;
     f_number_unsigned_t j = 1;
@@ -65,10 +62,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!length) return F_data_not;
-
-    if (!destination->used) {
-      return private_f_string_append_nulless(source, length, destination);
-    }
+    if (!destination->used) return private_f_string_append_nulless(source, length, destination);
 
     f_number_unsigned_t i = 1;
     f_number_unsigned_t j = 1;
@@ -120,7 +114,7 @@ extern "C" {
     if (!length) return F_data_not;
 
     if (glue_length && destination->used) {
-      f_status_t status = private_f_string_append(glue, glue_length, destination);
+      const f_status_t status = private_f_string_append(glue, glue_length, destination);
       if (F_status_is_error(status)) return status;
     }
 
@@ -154,7 +148,7 @@ extern "C" {
     if (!length) return F_data_not;
 
     if (glue_length && destination->used) {
-      f_status_t status = private_f_string_prepend(glue, glue_length, destination);
+      const f_status_t status = private_f_string_prepend(glue, glue_length, destination);
       if (F_status_is_error(status)) return status;
     }
 
@@ -171,7 +165,7 @@ extern "C" {
     if (!length) return F_data_not;
 
     if (glue_length && destination->used) {
-      f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination);
+      const f_status_t status = private_f_string_prepend_nulless(glue, glue_length, destination);
       if (F_status_is_error(status)) return status;
     }
 
@@ -198,10 +192,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!length) return F_data_not;
-
-    if (destination->used < length) {
-      return private_f_string_prepend(source, length, destination);
-    }
+    if (destination->used < length) return private_f_string_prepend(source, length, destination);
 
     f_number_unsigned_t i = 0;
     f_number_unsigned_t j = 0;
@@ -239,10 +230,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!length) return F_data_not;
-
-    if (!destination->used) {
-      return private_f_string_prepend_nulless(source, length, destination);
-    }
+    if (!destination->used) return private_f_string_prepend_nulless(source, length, destination);
 
     f_number_unsigned_t i = 0;
     f_number_unsigned_t j = 0;
@@ -291,17 +279,13 @@ extern "C" {
       if (!range) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (range->start > range->stop) {
-      return F_data_not_stop;
-    }
+    if (range->start > range->stop) return F_data_not_stop;
 
     while (string[range->start] != f_string_eol_s.string[0]) {
 
       ++range->start;
 
-      if (range->start > range->stop) {
-        return F_none_stop;
-      }
+      if (range->start > range->stop) return F_none_stop;
     } // while
 
     return F_none;
@@ -314,21 +298,15 @@ extern "C" {
       if (!range) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (range->start > range->stop) {
-      return F_data_not_stop;
-    }
+    if (range->start > range->stop) return F_data_not_stop;
 
     while (string[range->start] != seek_to) {
 
-      if (string[range->start] == f_string_eol_s.string[0]) {
-        return F_none_eol;
-      }
+      if (string[range->start] == f_string_eol_s.string[0]) return F_none_eol;
 
       ++range->start;
 
-      if (range->start > range->stop) {
-        return F_none_stop;
-      }
+      if (range->start > range->stop) return F_none_stop;
     } // while
 
     return F_none;
@@ -341,17 +319,13 @@ extern "C" {
       if (!range) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (range->start > range->stop) {
-      return F_data_not_stop;
-    }
+    if (range->start > range->stop) return F_data_not_stop;
 
     while (string[range->start] != seek_to) {
 
       ++range->start;
 
-      if (range->start > range->stop) {
-        return F_none_stop;
-      }
+      if (range->start > range->stop) return F_none_stop;
     } // while
 
     return F_none;
index a5670a35a5597274ad10bf7bea90ab0c9ef494df..d99c68bc2abe98be5175e45821e7df2f88f7aa70 100644 (file)
@@ -12,7 +12,7 @@ extern "C" {
       if (!dynamic) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_string_dynamic_adjust(length, dynamic);
+    return f_memory_array_adjust(length, sizeof(f_string_t), (void **) &dynamic->string, &dynamic->used, &dynamic->size);
   }
 #endif // _di_f_string_dynamic_adjust_
 
@@ -35,10 +35,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!source.used) return F_data_not;
-
-    if (destination->used < source.used) {
-      return private_f_string_append(source.string, source.used, destination);
-    }
+    if (destination->used < source.used) return private_f_string_append(source.string, source.used, destination);
 
     f_number_unsigned_t i = 1;
     f_number_unsigned_t j = 1;
@@ -64,10 +61,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!source.used) return F_data_not;
-
-    if (!destination->used) {
-      return private_f_string_append_nulless(source.string, source.used, destination);
-    }
+    if (!destination->used) return private_f_string_append_nulless(source.string, source.used, destination);
 
     f_number_unsigned_t i = 1;
     f_number_unsigned_t j = 1;
@@ -116,13 +110,7 @@ extern "C" {
       if (!dynamic) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
-
-    if (dynamic->size > amount) {
-      return private_f_string_dynamic_adjust(dynamic->size - amount, dynamic);
-    }
-
-    return private_f_string_dynamic_adjust(0, dynamic);
+    return f_memory_array_decimate_by(amount, sizeof(f_string_t), (void **) &dynamic->string, &dynamic->used, &dynamic->size);
   }
 #endif // _di_f_string_dynamic_decimate_by_
 
@@ -132,13 +120,7 @@ extern "C" {
       if (!dynamic) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
-
-    if (dynamic->size > amount) {
-      return private_f_string_dynamic_resize(dynamic->size - amount, dynamic);
-    }
-
-    return private_f_string_dynamic_resize(0, dynamic);
+    return f_memory_array_decrease_by(amount, sizeof(f_string_t), (void **) &dynamic->string, &dynamic->used, &dynamic->size);
   }
 #endif // _di_f_string_dynamic_decrease_by_
 
@@ -148,21 +130,7 @@ extern "C" {
       if (!dynamic) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (step && dynamic->used + 1 > dynamic->size) {
-      f_number_unsigned_t size = dynamic->used + step;
-
-      if (size > F_string_t_size_d) {
-        if (dynamic->used + 1 > F_string_t_size_d) {
-          return F_status_set_error(F_string_too_large);
-        }
-
-        size = F_string_t_size_d;
-      }
-
-      return private_f_string_dynamic_resize(size, dynamic);
-    }
-
-    return F_data_not;
+    return f_memory_array_increase(step, sizeof(f_string_t), (void **) &dynamic->string, &dynamic->used, &dynamic->size);
   }
 #endif // _di_f_string_dynamic_increase_
 
@@ -172,9 +140,7 @@ extern "C" {
       if (!dynamic) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
-
-    return private_f_string_dynamic_increase_by(amount, dynamic);
+    return f_memory_array_increase_by(amount, sizeof(f_string_t), (void **) &dynamic->string, &dynamic->used, &dynamic->size);
   }
 #endif // _di_f_string_dynamic_increase_by_
 
@@ -276,9 +242,7 @@ extern "C" {
 
     const f_number_unsigned_t length = range.stop >= source.used ? source.used - range.start : (range.stop - range.start) + 1;
 
-    if (destination->used < length) {
-      return private_f_string_append(source.string + range.start, length, destination);
-    }
+    if (destination->used < length) return private_f_string_append(source.string + range.start, length, destination);
 
     const f_number_unsigned_t stop = range.stop >= source.used ? source.used : range.stop + 1;
     f_number_unsigned_t i = 1;
@@ -310,9 +274,7 @@ extern "C" {
 
     const f_number_unsigned_t length = range.stop >= source.used ? source.used - range.start : (range.stop - range.start) + 1;
 
-    if (!destination->used) {
-      return private_f_string_append_nulless(source.string + range.start, length, destination);
-    }
+    if (!destination->used) return private_f_string_append_nulless(source.string + range.start, length, destination);
 
     const f_number_unsigned_t stop = range.stop >= source.used ? source.used : range.stop + 1;
     f_number_unsigned_t i = 1;
@@ -484,9 +446,7 @@ extern "C" {
 
     const f_number_unsigned_t length = range.stop >= source.used ? source.used - range.start : (range.stop - range.start) + 1;
 
-    if (destination->used < length) {
-      return private_f_string_prepend(source.string + range.start, length, destination);
-    }
+    if (destination->used < length) return private_f_string_prepend(source.string + range.start, length, destination);
 
     f_number_unsigned_t i = 0;
     f_number_unsigned_t j = 0;
@@ -583,19 +543,14 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!source.used) return F_data_not;
-
-    if (destination->used < source.used) {
-      return private_f_string_prepend(source.string, source.used, destination);
-    }
+    if (destination->used < source.used) return private_f_string_prepend(source.string, source.used, destination);
 
     f_number_unsigned_t i = 0;
     f_number_unsigned_t j = 0;
 
     while (i < source.used && j < destination->used) {
 
-      if (source.string[i] != destination->string[j]) {
-        return private_f_string_prepend(source.string, source.used, destination);
-      }
+      if (source.string[i] != destination->string[j]) return private_f_string_prepend(source.string, source.used, destination);
 
       ++i;
       ++j;
@@ -612,10 +567,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (!source.used) return F_data_not;
-
-    if (!destination->used) {
-      return private_f_string_prepend_nulless(source.string, source.used, destination);
-    }
+    if (!destination->used) return private_f_string_prepend_nulless(source.string, source.used, destination);
 
     f_number_unsigned_t i = 0;
     f_number_unsigned_t j = 0;
@@ -634,9 +586,7 @@ extern "C" {
         continue;
       }
 
-      if (source.string[i] != destination->string[j]) {
-        return private_f_string_prepend_nulless(source.string, source.used, destination);
-      }
+      if (source.string[i] != destination->string[j]) return private_f_string_prepend_nulless(source.string, source.used, destination);
 
       ++i;
       ++j;
@@ -664,7 +614,7 @@ extern "C" {
       if (!buffer) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_string_dynamic_resize(length, buffer);
+    return f_memory_array_resize(length, sizeof(f_string_t), (void **) &buffer->string, &buffer->used, &buffer->size);
   }
 #endif // _di_f_string_dynamic_resize_
 
@@ -742,8 +692,8 @@ extern "C" {
     if (destination->used && !destination->string[destination->used - 1]) return F_none;
     if (destination->used == F_string_t_size_d) return F_status_set_error(F_string_too_large);
 
-    if (destination->used + 1 > destination->size) {
-      const f_status_t status = private_f_string_dynamic_resize(destination->used + (destination->used + 1 == F_string_t_size_d ? 1 : F_memory_default_allocation_small_d), destination);
+    {
+      const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
@@ -760,15 +710,13 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (destination->used < destination->size) {
-      if (!destination->string[destination->used]) {
-        return F_none;
-      }
+      if (!destination->string[destination->used]) return F_none;
     }
 
     if (destination->used == F_string_t_size_d) return F_status_set_error(F_string_too_large);
 
-    if (destination->used + 1 > destination->size) {
-      const f_status_t status = private_f_string_dynamic_resize(destination->used + (destination->used + 1 == F_string_t_size_d ? 1 : F_memory_default_allocation_small_d), destination);
+    {
+      const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_string_t), (void **) &destination->string, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
index c3a399d3fcebae8489ec08003bddb1929b17e10f..8869ec3b2c45d0ce5e05a3b0d6e2c31777b5cecc 100644 (file)
@@ -49,11 +49,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (dynamics->size > amount) {
-      return private_f_string_dynamics_adjust(dynamics->size - amount, dynamics);
-    }
-
-    return private_f_string_dynamics_adjust(0, dynamics);
+    return private_f_string_dynamics_adjust((dynamics->size > amount) ? dynamics->size - amount : 0, dynamics);
   }
 #endif // _di_f_string_dynamics_decimate_by_
 
@@ -65,11 +61,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (dynamics->size > amount) {
-      return private_f_string_dynamics_resize(dynamics->size - amount, dynamics);
-    }
-
-    return private_f_string_dynamics_resize(0, dynamics);
+    return private_f_string_dynamics_resize((dynamics->size > amount) ? dynamics->size - amount : 0, dynamics);
   }
 #endif // _di_f_string_dynamics_decrease_by_
 
@@ -85,9 +77,7 @@ extern "C" {
       f_number_unsigned_t size = dynamics->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (dynamics->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (dynamics->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index 3bd0565e1b9d27a4df238beb8e085b63ae1afda8..74aee6ca97b232e6d765f15b64aeedcdb8343f80 100644 (file)
@@ -83,11 +83,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (dynamicss->size > amount) {
-      return private_f_string_dynamicss_adjust(dynamicss->size - amount, dynamicss);
-    }
-
-    return private_f_string_dynamicss_adjust(0, dynamicss);
+    return private_f_string_dynamicss_adjust((dynamicss->size > amount) ? dynamicss->size - amount : 0, dynamicss);
   }
 #endif // _di_f_string_dynamicss_decimate_by_
 
@@ -99,11 +95,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (dynamicss->size > amount) {
-      return private_f_string_dynamicss_resize(dynamicss->size - amount, dynamicss);
-    }
-
-    return private_f_string_dynamicss_resize(0, dynamicss);
+    return private_f_string_dynamicss_resize((dynamicss->size > amount) ? dynamicss->size - amount : 0, dynamicss);
   }
 #endif // _di_f_string_dynamicss_decrease_by_
 
@@ -119,9 +111,7 @@ extern "C" {
       f_number_unsigned_t size = dynamicss->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (dynamicss->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (dynamicss->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index 4e54d4134aae8853c58ec2c1756c3ee2dea8c594..758e3e1206cbccf3fcdfad411efb5c0a354e7f34 100644 (file)
@@ -70,11 +70,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (map_multis->size > amount) {
-      return private_f_string_map_multis_adjust(map_multis->size - amount, map_multis);
-    }
-
-    return private_f_string_map_multis_adjust(0, map_multis);
+    return private_f_string_map_multis_adjust((map_multis->size > amount) ? map_multis->size - amount : 0, map_multis);
   }
 #endif // _di_f_string_map_multis_decimate_by_
 
@@ -86,11 +82,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (map_multis->size > amount) {
-      return private_f_string_map_multis_resize(map_multis->size - amount, map_multis);
-    }
-
-    return private_f_string_map_multis_resize(0, map_multis);
+    return private_f_string_map_multis_resize((map_multis->size > amount) ? map_multis->size - amount : 0, map_multis);
   }
 #endif // _di_f_string_map_multis_decrease_by_
 
@@ -104,9 +96,7 @@ extern "C" {
       f_number_unsigned_t size = map_multis->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (map_multis->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (map_multis->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index e269af6aa380487f6cfaf95fdf874300c36567c2..29b046442c48b330d4659d0e34d0f29fd57fa755 100644 (file)
@@ -84,11 +84,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (map_multiss->size > amount) {
-      return private_f_string_map_multiss_adjust(map_multiss->size - amount, map_multiss);
-    }
-
-    return private_f_string_map_multiss_adjust(0, map_multiss);
+    return private_f_string_map_multiss_adjust((map_multiss->size > amount) ? map_multiss->size - amount : 0, map_multiss);
   }
 #endif // _di_f_string_map_multiss_decimate_by_
 
@@ -100,11 +96,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (map_multiss->size > amount) {
-      return private_f_string_map_multiss_resize(map_multiss->size - amount, map_multiss);
-    }
-
-    return private_f_string_map_multiss_resize(0, map_multiss);
+    return private_f_string_map_multiss_resize((map_multiss->size > amount) ? map_multiss->size - amount : 0, map_multiss);
   }
 #endif // _di_f_string_map_multiss_decrease_by_
 
@@ -118,9 +110,7 @@ extern "C" {
       f_number_unsigned_t size = map_multiss->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (map_multiss->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (map_multiss->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index 93324e895000195b84194263a755a855a8810d24..bc12a2bbea159d3eca7c80692558fd18d80a8ca0 100644 (file)
@@ -68,11 +68,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (maps->size > amount) {
-      return private_f_string_maps_adjust(maps->size - amount, maps);
-    }
-
-    return private_f_string_maps_adjust(0, maps);
+    return private_f_string_maps_adjust((maps->size > amount) ? maps->size - amount : 0, maps);
   }
 #endif // _di_f_string_maps_decimate_by_
 
@@ -84,11 +80,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (maps->size > amount) {
-      return private_f_string_maps_resize(maps->size - amount, maps);
-    }
-
-    return private_f_string_maps_resize(0, maps);
+    return private_f_string_maps_resize((maps->size > amount) ? maps->size - amount : 0, maps);
   }
 #endif // _di_f_string_maps_decrease_by_
 
@@ -102,9 +94,7 @@ extern "C" {
       f_number_unsigned_t size = maps->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (maps->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (maps->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index ddd38247f6adbf6537b91dc55682da540c1b44d3..a68f0b7f38e68c7586c40ac07ee0837e70d19c27 100644 (file)
@@ -82,11 +82,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (mapss->size > amount) {
-      return private_f_string_mapss_adjust(mapss->size - amount, mapss);
-    }
-
-    return private_f_string_mapss_adjust(0, mapss);
+    return private_f_string_mapss_adjust((mapss->size > amount) ? mapss->size - amount : 0, mapss);
   }
 #endif // _di_f_string_mapss_decimate_by_
 
@@ -98,11 +94,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (mapss->size > amount) {
-      return private_f_string_mapss_resize(mapss->size - amount, mapss);
-    }
-
-    return private_f_string_mapss_resize(0, mapss);
+    return private_f_string_mapss_resize((mapss->size > amount) ? mapss->size - amount : 0, mapss);
   }
 #endif // _di_f_string_mapss_decrease_by_
 
@@ -116,9 +108,7 @@ extern "C" {
       f_number_unsigned_t size = mapss->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (mapss->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (mapss->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index 7bb7cbf9e69d942b3d1446da3172c4eea6a1051e..b947a17bdc7f4d6093c2508c57fcdaf53fb92711 100644 (file)
@@ -6,53 +6,6 @@
 extern "C" {
 #endif
 
-#if !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_)
-  f_status_t private_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const dynamic) {
-
-    const f_status_t status = f_memory_adjust(dynamic->size, length, sizeof(f_char_t), (void **) & dynamic->string);
-    if (F_status_is_error(status)) return status;
-
-    dynamic->size = length;
-
-    if (dynamic->used > dynamic->size) {
-      dynamic->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_)
-
-#if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_)
-  f_status_t private_f_string_dynamic_increase_by(const f_number_unsigned_t amount, f_string_dynamic_t * const dynamic) {
-
-    const f_number_unsigned_t length = dynamic->used + amount;
-
-    if (length > dynamic->size) {
-      if (length > F_string_t_size_d) return F_status_set_error(F_string_too_large);
-
-      return private_f_string_dynamic_resize(length, dynamic);
-    }
-
-    return F_data_not;
-  }
-#endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_)
-
-#if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_)
-  f_status_t private_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const dynamic) {
-
-    const f_status_t status = f_memory_resize(dynamic->size, length, sizeof(f_char_t), (void **) & dynamic->string);
-    if (F_status_is_error(status)) return status;
-
-    dynamic->size = length;
-
-    if (dynamic->used > dynamic->size) {
-      dynamic->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 504366a93cf9e7a0f449125e937a0b32b24fa425..c0b536a04ef50bf85888b8b9631dbfaade8e84a1 100644 (file)
 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 dynamic
- *   The string to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @see f_string_dynamic_adjust()
- * @see f_string_dynamic_decimate_by()
- * @see f_string_dynamics_adjust()
- * @see f_string_dynamics_append()
- * @see f_string_dynamics_decimate_by()
- * @see f_string_map_multis_adjust()
- * @see f_string_map_multis_append()
- * @see f_string_triples_adjust()
- * @see f_string_triples_decimate_by()
- */
-#if !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_)
-  extern f_status_t private_f_string_dynamic_adjust(const f_number_unsigned_t length, f_string_dynamic_t * const dynamic) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_string_dynamic_adjust_) || !defined(_di_f_string_dynamic_decimate_by_) || !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_)
-
-/**
- * Private implementation of f_string_dynamic_increase_by().
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param amount
- *   A positive number representing how much to increase the size by.
- * @param dynamic
- *   The string to resize.
- *
- * @return
- *   F_none on success.
- *   F_data_not on success, but there is no reason to increase size (used + amount <= size).
- *
- *   F_string_too_large (with error bit) if the combined string is too large.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see memcpy()
- *
- * @see f_string_append()
- * @see f_string_append_assure()
- * @see f_string_append_mash()
- * @see f_string_append_nulless()
- * @see f_string_dynamic_append()
- * @see f_string_dynamic_append_assure()
- * @see f_string_dynamic_append_nulless()
- * @see f_string_dynamic_increase_by()
- * @see f_string_dynamic_mash()
- * @see f_string_dynamic_mash_nulless()
- * @see f_string_dynamic_partial_append)
- * @see f_string_dynamic_partial_append_assure()
- * @see f_string_dynamic_partial_mash()
- * @see f_string_dynamic_prepend()
- * @see f_string_dynamic_prepend_nulless()
- * @see f_string_dynamics_append()
- * @see f_string_map_multis_append()
- * @see f_string_mash()
- * @see f_string_mash_nulless()
- * @see f_string_maps_append()
- * @see f_string_prepend()
- * @see f_string_prepend_nulless()
- * @see f_string_triples_append()
- */
-#if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_)
-  extern f_status_t private_f_string_dynamic_increase_by(const f_number_unsigned_t amount, f_string_dynamic_t * const dynamic) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(_di_f_string_dynamic_partial_append_) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_)
-
-/**
- * Private implementation for resizing.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The new size to use.
- * @param dynamic
- *   The string to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- * @see f_string_append()
- * @see f_string_append_assure()
- * @see f_string_append_mash()
- * @see f_string_append_nulless()
- * @see f_string_dynamic_append()
- * @see f_string_dynamic_append_assure()
- * @see f_string_dynamic_append_nulless()
- * @see f_string_dynamic_decrease_by()
- * @see f_string_dynamic_increase()
- * @see f_string_dynamic_increase_by()
- * @see f_string_dynamic_mash()
- * @see f_string_dynamic_mash_nulless()
- * @see f_string_dynamic_partial_append)
- * @see f_string_dynamic_partial_append_assure()
- * @see f_string_dynamic_partial_mash()
- * @see f_string_dynamic_prepend()
- * @see f_string_dynamic_prepend_nulless()
- * @see f_string_dynamic_terminate()
- * @see f_string_dynamic_terminate_after()
- * @see f_string_dynamics_append()
- * @see f_string_map_multis_append()
- * @see f_string_mash_nulless()
- * @see f_string_mash()
- * @see f_string_maps_append()
- * @see f_string_prepend()
- * @see f_string_prepend_nulless()
- * @see f_string_triples_append()
- */
-#if !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_)
-  extern f_status_t private_f_string_dynamic_resize(const f_number_unsigned_t length, f_string_dynamic_t * const dynamic) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_string_append_) || !defined(_di_f_string_append_assure_) || !defined(_di_f_string_append_mash_) || !defined(_di_f_string_append_nulless_) || !defined(_di_f_string_dynamic_append_) || !defined(_di_f_string_dynamic_append_assure_) || !defined(_di_f_string_dynamic_append_nulless_) || !defined(_di_f_string_dynamic_decrease_by_) || !defined(_di_f_string_dynamic_increase_) || !defined(_di_f_string_dynamic_increase_by_) || !defined(_di_f_string_dynamic_mash_) || !defined(_di_f_string_dynamic_mash_nulless_) || !defined(f_string_dynamic_partial_append) || !defined(_di_f_string_dynamic_partial_append_assure_) || !defined(_di_f_string_dynamic_partial_mash_) || !defined(_di_f_string_dynamic_prepend_) || !defined(_di_f_string_dynamic_prepend_nulless_) || !defined(_di_f_string_dynamic_terminate_) || !defined(_di_f_string_dynamic_terminate_after_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_mash_nulless_) || !defined(_di_f_string_mash_) || !defined(_di_f_string_maps_append_) || !defined(_di_f_string_prepend_) || !defined(_di_f_string_prepend_nulless_) || !defined(_di_f_string_triples_append_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index f0c065955e4ed1b8c847f440f77f83966bc77bcc..b6472f134e6f1846e8e96c81254c51a5953d8cba 100644 (file)
@@ -10,26 +10,15 @@ extern "C" {
 #if !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
   f_status_t private_f_string_dynamics_adjust(const f_number_unsigned_t length, f_string_dynamics_t * const dynamics) {
 
-    if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < dynamics->size; ++i) {
 
-      status = private_f_string_dynamic_adjust(0, &dynamics->array[i]);
+      status = f_memory_array_adjust(0, sizeof(f_string_t), (void **) &dynamics->array[i].string, &dynamics->array[i].used, &dynamics->array[i].size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(dynamics->size, length, sizeof(f_string_dynamic_t), (void **) & dynamics->array);
-    if (F_status_is_error(status)) return status;
-
-    dynamics->size = length;
-
-    if (dynamics->used > dynamics->size) {
-      dynamics->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_dynamic_t), (void **) &dynamics->array, &dynamics->used, &dynamics->size);
   }
 #endif // !defined(_di_f_string_dynamics_adjust_) || !defined(_di_f_string_dynamics_append_) || !defined(_di_f_string_dynamics_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
 
@@ -83,26 +72,15 @@ extern "C" {
 #if !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_) || !defined(f_string_dynamics_resize) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_map_multis_append_all_) || !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_resize_) || !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multiss_append_all_) || !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_)
   f_status_t private_f_string_dynamics_resize(const f_number_unsigned_t length, f_string_dynamics_t * const dynamics) {
 
-    if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < dynamics->size; ++i) {
 
-      status = private_f_string_dynamic_resize(0, &dynamics->array[i]);
+      status = f_memory_array_resize(0, sizeof(f_string_t), (void **) &dynamics->array[i].string, &dynamics->array[i].used, &dynamics->array[i].size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(dynamics->size, length, sizeof(f_string_dynamic_t), (void **) & dynamics->array);
-    if (F_status_is_error(status)) return status;
-
-    dynamics->size = length;
-
-    if (dynamics->used > dynamics->size) {
-      dynamics->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_dynamic_t), (void **) &dynamics->array, &dynamics->used, &dynamics->size);
   }
 #endif // !defined(_di_f_string_dynamics_decrease_by_) || !defined(_di_f_string_dynamics_increase_) || !defined(_di_f_string_dynamics_increase_by_) || !defined(f_string_dynamics_resize) || !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_map_multis_append_all_) || !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_resize_) || !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multiss_append_all_) || !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_)
 
index 7508fee53492c9f4c7a9381089b21704e5e340f7..611591ecc5f8c46abad17c6b7eb6b2e3b1a95825 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
  * @param length
  *   The new size to use.
  * @param dynamics
- *   The strings to adjust.
+ *   The dynamics to adjust.
  *
  * @return
  *   F_none on success.
@@ -52,7 +52,7 @@ extern "C" {
  * @param source
  *   The source string to append.
  * @param destination
- *   The destination strings the source is appended onto.
+ *   The destination dynamics the source is appended onto.
  *
  * @return
  *   F_none on success.
@@ -79,7 +79,7 @@ extern "C" {
  * @param source
  *   The source strings to append.
  * @param destination
- *   The destination strings the source is appended onto.
+ *   The destination dynamics the source is appended onto.
  *
  * @return
  *   F_none on success.
@@ -106,7 +106,7 @@ extern "C" {
  * @param length
  *   The new size to use.
  * @param dynamics
- *   The strings to resize.
+ *   The dynamics to resize.
  *
  * @return
  *   F_none on success.
index 76374c9d274f301c7c32c3aff07663e9582f2187..6c7cbd56c37708fe025c61da79a2dd51ad11656e 100644 (file)
@@ -11,8 +11,6 @@ extern "C" {
 #if !defined(_di_f_string_dynamicss_adjust_) || !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_dynamicss_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
   f_status_t private_f_string_dynamicss_adjust(const f_number_unsigned_t length, f_string_dynamicss_t * const dynamicss) {
 
-    if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < dynamicss->size; ++i) {
@@ -21,24 +19,13 @@ extern "C" {
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(dynamicss->size, length, sizeof(f_string_dynamics_t), (void **) & dynamicss->array);
-    if (F_status_is_error(status)) return status;
-
-    dynamicss->size = length;
-
-    if (dynamicss->used > dynamicss->size) {
-      dynamicss->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_dynamics_t), (void **) &dynamicss->array, &dynamicss->used, &dynamicss->size);
   }
 #endif // !defined(_di_f_string_dynamicss_adjust_) || !defined(_di_f_string_dynamicss_append_) || !defined(_di_f_string_dynamicss_decimate_by_) || !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_append_)
 
 #if !defined(_di_f_string_dynamicss_decrease_by_) || !defined(_di_f_string_dynamicss_increase_) || !defined(_di_f_string_dynamicss_increase_by_) || !defined(_di_f_string_dynamicss_append_all_) || !defined(_di_f_string_map_multis_append_all_)
   f_status_t private_f_string_dynamicss_resize(const f_number_unsigned_t length, f_string_dynamicss_t * const dynamicss) {
 
-    if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < dynamicss->size; ++i) {
@@ -47,16 +34,7 @@ extern "C" {
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(dynamicss->size, length, sizeof(f_string_dynamics_t), (void **) & dynamicss->array);
-    if (F_status_is_error(status)) return status;
-
-    dynamicss->size = length;
-
-    if (dynamicss->used > dynamicss->size) {
-      dynamicss->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_dynamics_t), (void **) &dynamicss->array, &dynamicss->used, &dynamicss->size);
   }
 #endif // !defined(_di_f_string_dynamicss_decrease_by_) || !defined(_di_f_string_dynamicss_increase_) || !defined(_di_f_string_dynamicss_increase_by_) || !defined(_di_f_string_dynamicss_append_all_) || !defined(_di_f_string_map_multis_append_all_)
 
index 1a4a796b9bf9336d152a303e91f67cd233c4724c..decf9eabb0e5c1acbb2f5330dd2778407619814d 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
  * @param length
  *   The new size to use.
  * @param dynamicss
- *   The strings to adjust.
+ *   The dynamicss to adjust.
  *
  * @return
  *   F_none on success.
@@ -52,7 +52,7 @@ extern "C" {
  * @param length
  *   The new size to use.
  * @param dynamicss
- *   The strings to resize.
+ *   The dynamicss to resize.
  *
  * @return
  *   F_none on success.
index fcbdb8672443b27c595f933e53aec1e3dd38da2b..328ce65f97443a4a0d1040a511749cd8f471d7a8 100644 (file)
@@ -11,31 +11,18 @@ extern "C" {
 #if !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_decimate_by_)
   f_status_t private_f_string_map_multis_adjust(const f_number_unsigned_t length, f_string_map_multis_t * const map_multis) {
 
-    if (map_multis->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < map_multis->size; ++i) {
 
-      status = private_f_string_dynamic_adjust(0, &map_multis->array[i].name);
+      status = f_memory_array_adjust(0, sizeof(f_string_t), (void **) &map_multis->array[i].name.string, &map_multis->array[i].name.used, &map_multis->array[i].name.size);
       if (F_status_is_error(status)) return status;
 
       status = private_f_string_dynamics_adjust(0, &map_multis->array[i].value);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(map_multis->size, length, sizeof(f_string_map_multi_t), (void **) & map_multis->array);
-    if (F_status_is_error(status)) return status;
-
-    map_multis->size = length;
-
-    if (map_multis->used > map_multis->size) {
-      map_multis->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_map_multi_t), (void **) &map_multis->array, &map_multis->used, &map_multis->size);
   }
 #endif // !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_decimate_by_)
 
@@ -72,31 +59,18 @@ extern "C" {
 #if !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_map_multis_append_all_) || !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_resize_) || !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multiss_append_all_) || !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_)
   f_status_t private_f_string_map_multis_resize(const f_number_unsigned_t length, f_string_map_multis_t * const map_multis) {
 
-    if (map_multis->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < map_multis->size; ++i) {
 
-      status = private_f_string_dynamic_resize(0, &map_multis->array[i].name);
+      status = f_memory_array_resize(0, sizeof(f_string_t), (void **) &map_multis->array[i].name.string, &map_multis->array[i].name.used, &map_multis->array[i].name.size);
       if (F_status_is_error(status)) return status;
 
       status = private_f_string_dynamics_resize(0, &map_multis->array[i].value);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(map_multis->size, length, sizeof(f_string_map_multi_t), (void **) & map_multis->array);
-    if (F_status_is_error(status)) return status;
-
-    map_multis->size = length;
-
-    if (map_multis->used > map_multis->size) {
-      map_multis->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_map_multi_t), (void **) &map_multis->array, &map_multis->used, &map_multis->size);
   }
 #endif // !defined(_di_f_string_map_multis_append_) || !defined(_di_f_string_map_multis_append_all_) || !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_resize_) || !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multiss_append_all_) || !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_)
 
index a8236531b86c9946616b2b32ca29633343b66fff..60af0f75c176b0da9f0cdbc42800d574deef0fa3 100644 (file)
@@ -46,7 +46,7 @@ extern "C" {
  * Intended to be shared to each of the different implementation variations.
  *
  * @param source
- *   The source map_multis to append.
+ *   The source destination to append.
  * @param destination
  *   The destination map_multis the source is appended onto.
  *
index f25b375b7c9ddb01df51dc8779a5fdc2f6ae4231..e2d5afa157ef0680b5fd53914fb4e9ae746f22b9 100644 (file)
@@ -12,10 +12,6 @@ extern "C" {
 #if !defined(_di_f_string_map_multiss_adjust_) || !defined(_di_f_string_map_multiss_decimate_by_)
   f_status_t private_f_string_map_multiss_adjust(const f_number_unsigned_t length, f_string_map_multiss_t * const map_multiss) {
 
-    if (map_multiss->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < map_multiss->size; ++i) {
@@ -24,26 +20,13 @@ extern "C" {
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(map_multiss->size, length, sizeof(f_string_map_multis_t), (void **) & map_multiss->array);
-    if (F_status_is_error(status)) return status;
-
-    map_multiss->size = length;
-
-    if (map_multiss->used > map_multiss->size) {
-      map_multiss->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_map_multis_t), (void **) &map_multiss->array, &map_multiss->used, &map_multiss->size);
   }
 #endif // !defined(_di_f_string_map_multiss_adjust_) || !defined(_di_f_string_map_multiss_decimate_by_)
 
 #if !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_)
   f_status_t private_f_string_map_multiss_resize(const f_number_unsigned_t length, f_string_map_multiss_t * const map_multiss) {
 
-    if (map_multiss->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < map_multiss->size; ++i) {
@@ -52,16 +35,7 @@ extern "C" {
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(map_multiss->size, length, sizeof(f_string_map_multis_t), (void **) & map_multiss->array);
-    if (F_status_is_error(status)) return status;
-
-    map_multiss->size = length;
-
-    if (map_multiss->used > map_multiss->size) {
-      map_multiss->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_map_multis_t), (void **) &map_multiss->array, &map_multiss->used, &map_multiss->size);
   }
 #endif // !defined(_di_f_string_map_multiss_decrease_by_) || !defined(_di_f_string_map_multiss_increase_) || !defined(_di_f_string_map_multiss_increase_by_)
 
index 18588cd45269ce2877bd203fba024c8fa4b0cf2a..86b54c926d02aec7d629bfaaac9bb8187bf9b4e5 100644 (file)
@@ -10,31 +10,18 @@ extern "C" {
 #if !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_)
   f_status_t private_f_string_maps_adjust(const f_number_unsigned_t length, f_string_maps_t * const maps) {
 
-    if (maps->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < maps->size; ++i) {
 
-      status = private_f_string_dynamic_adjust(0, &maps->array[i].name);
+      status = f_memory_array_adjust(0, sizeof(f_string_t), (void **) &maps->array[i].name.string, &maps->array[i].name.used, &maps->array[i].name.size);
       if (F_status_is_error(status)) return status;
 
-      status = private_f_string_dynamic_adjust(0, &maps->array[i].value);
+      status = f_memory_array_adjust(0, sizeof(f_string_t), (void **) &maps->array[i].value.string, &maps->array[i].value.used, &maps->array[i].value.size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(maps->size, length, sizeof(f_string_map_t), (void **) & maps->array);
-    if (F_status_is_error(status)) return status;
-
-    maps->size = length;
-
-    if (maps->used > maps->size) {
-      maps->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_map_t), (void **) &maps->array, &maps->used, &maps->size);
   }
 #endif // !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_)
 
@@ -71,31 +58,18 @@ extern "C" {
 #if !defined(_di_f_string_maps_append_) || !defined(_di_f_string_maps_append_all_) || !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_resize_) || !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_mapss_append_all_) || !defined(_di_f_string_mapss_decrease_by_) || !defined(_di_f_string_mapss_increase_) || !defined(_di_f_string_mapss_increase_by_)
   f_status_t private_f_string_maps_resize(const f_number_unsigned_t length, f_string_maps_t * const maps) {
 
-    if (maps->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < maps->size; ++i) {
 
-      status = private_f_string_dynamic_resize(0, &maps->array[i].name);
+      status = f_memory_array_resize(0, sizeof(f_string_t), (void **) &maps->array[i].name.string, &maps->array[i].name.used, &maps->array[i].name.size);
       if (F_status_is_error(status)) return status;
 
-      status = private_f_string_dynamic_resize(0, &maps->array[i].value);
+      status = f_memory_array_resize(0, sizeof(f_string_t), (void **) &maps->array[i].value.string, &maps->array[i].value.used, &maps->array[i].value.size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(maps->size, length, sizeof(f_string_map_t), (void **) & maps->array);
-    if (F_status_is_error(status)) return status;
-
-    maps->size = length;
-
-    if (maps->used > maps->size) {
-      maps->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_map_t), (void **) &maps->array, &maps->used, &maps->size);
   }
 #endif // !defined(_di_f_string_maps_append_) || !defined(_di_f_string_maps_append_all_) || !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_resize_) || !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_mapss_append_all_) || !defined(_di_f_string_mapss_decrease_by_) || !defined(_di_f_string_mapss_increase_) || !defined(_di_f_string_mapss_increase_by_)
 
index 59a867f461aee5ffcb78d8015391b6a600aa3580..ae0641293b652bdc9797e73cf3b7e098a7d161ec 100644 (file)
@@ -33,6 +33,7 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_adjust().
  *
  * @see f_memory_adjust()
+ *
  * @see f_string_maps_adjust()
  */
 #if !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_)
@@ -45,7 +46,7 @@ extern "C" {
  * Intended to be shared to each of the different implementation variations.
  *
  * @param source
- *   The source maps to append.
+ *   The source destination to append.
  * @param destination
  *   The destination maps the source is appended onto.
  *
@@ -57,6 +58,7 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_resize().
  *
  * @see f_memory_resize()
+ *
  * @see f_string_maps_append_all()
  * @see f_string_mapss_append()
  * @see f_string_mapss_append_all()
index c59cee8d1d959c7fc040e3c006f0c0c9480310f8..961a1cc058e596fe389de822185a01e350ce2387 100644 (file)
@@ -11,10 +11,6 @@ extern "C" {
 #if !defined(_di_f_string_mapss_adjust_) || !defined(_di_f_string_mapss_decimate_by_)
   f_status_t private_f_string_mapss_adjust(const f_number_unsigned_t length, f_string_mapss_t * const mapss) {
 
-    if (mapss->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < mapss->size; ++i) {
@@ -23,26 +19,13 @@ extern "C" {
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(mapss->size, length, sizeof(f_string_maps_t), (void **) & mapss->array);
-    if (F_status_is_error(status)) return status;
-
-    mapss->size = length;
-
-    if (mapss->used > mapss->size) {
-      mapss->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_maps_t), (void **) &mapss->array, &mapss->used, &mapss->size);
   }
 #endif // !defined(_di_f_string_mapss_adjust_) || !defined(_di_f_string_mapss_decimate_by_)
 
 #if !defined(_di_f_string_mapss_decrease_by_) || !defined(_di_f_string_mapss_increase_) || !defined(_di_f_string_mapss_increase_by_)
   f_status_t private_f_string_mapss_resize(const f_number_unsigned_t length, f_string_mapss_t * const mapss) {
 
-    if (mapss->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < mapss->size; ++i) {
@@ -51,16 +34,7 @@ extern "C" {
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(mapss->size, length, sizeof(f_string_maps_t), (void **) & mapss->array);
-    if (F_status_is_error(status)) return status;
-
-    mapss->size = length;
-
-    if (mapss->used > mapss->size) {
-      mapss->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_maps_t), (void **) &mapss->array, &mapss->used, &mapss->size);
   }
 #endif // !defined(_di_f_string_mapss_decrease_by_) || !defined(_di_f_string_mapss_increase_) || !defined(_di_f_string_mapss_increase_by_)
 
index f4dfd9f03f5a818022415056bdd5442abc381d84..95a247aab4f293afb8e29c1087135365d1897cd2 100644 (file)
@@ -33,6 +33,7 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_adjust().
  *
  * @see f_memory_adjust()
+ *
  * @see f_string_mapss_adjust()
  */
 #if !defined(_di_f_string_mapss_adjust_) || !defined(_di_f_string_mapss_decimate_by_)
@@ -57,6 +58,7 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_resize().
  *
  * @see f_memory_resize()
+ *
  * @see f_string_mapss_decrease_by()
  * @see f_string_mapss_increase()
  * @see f_string_mapss_increase_by()
index 9db33a9d23607cd61b55ad17f81d012c3bd5a5e9..da888f3d127f4a2fce9b377edb3716eb82bc11b0 100644 (file)
@@ -6,31 +6,11 @@
 extern "C" {
 #endif
 
-#if !defined(_di_f_string_quantitys_adjust_) || !defined(_di_f_string_quantitys_decimate_by_)
-  f_status_t private_f_string_quantitys_adjust(const f_number_unsigned_t length, f_string_quantitys_t * const quantitys) {
-
-    if (quantitys->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
-    const f_status_t status = f_memory_adjust(quantitys->size, length, sizeof(f_string_quantity_t), (void **) & quantitys->array);
-    if (F_status_is_error(status)) return status;
-
-    quantitys->size = length;
-
-    if (quantitys->used > quantitys->size) {
-      quantitys->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_string_quantitys_adjust_) || !defined(_di_f_string_quantitys_decimate_by_)
-
 #if !defined(_di_f_string_quantitys_append_all_) || !defined(_di_f_string_quantityss_append_) || !defined(_di_f_string_quantityss_append_all_)
   f_status_t private_f_string_quantitys_append_all(const f_string_quantitys_t source, f_string_quantitys_t * const destination) {
 
-    if (destination->used + source.used > destination->size) {
-      const f_status_t status = private_f_string_quantitys_resize(destination->used + source.used, destination);
+    {
+      const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_string_quantity_t), (void **) &destination->array, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
@@ -44,26 +24,6 @@ extern "C" {
   }
 #endif // !defined(_di_f_string_quantitys_append_all_) || !defined(_di_f_string_quantityss_append_) || !defined(_di_f_string_quantityss_append_all_)
 
-#if !defined(_di_f_string_quantitys_decrease_) || !defined(_di_f_string_quantitys_decrease_by_) || !defined(_di_f_string_quantitys_increase_) || !defined(_di_f_string_quantitys_increase_by_)
-  f_status_t private_f_string_quantitys_resize(const f_number_unsigned_t length, f_string_quantitys_t * const quantitys) {
-
-    if (quantitys->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
-    const f_status_t status = f_memory_resize(quantitys->size, length, sizeof(f_string_quantity_t), (void **) & quantitys->array);
-    if (F_status_is_error(status)) return status;
-
-    quantitys->size = length;
-
-    if (quantitys->used > quantitys->size) {
-      quantitys->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_string_quantitys_decrease_) || !defined(_di_f_string_quantitys_decrease_by_) || !defined(_di_f_string_quantitys_increase_) || !defined(_di_f_string_quantitys_increase_by_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 17ad18faa9f91c3082dbaafe7fe7bba09c45516a..86ffe254c182289b126a7bfe2836d74045be6564 100644 (file)
@@ -16,30 +16,6 @@ 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 quantitys
- *   The quantitys to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   F_array_too_large (with error bit) if the combined array is too large.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @see f_string_quantitys_adjust()
- */
-#if !defined(_di_f_string_quantitys_adjust_) || !defined(_di_f_string_quantitys_decimate_by_)
-  extern f_status_t private_f_string_quantitys_adjust(const f_number_unsigned_t length, f_string_quantitys_t * const quantitys) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_string_quantitys_adjust_) || !defined(_di_f_string_quantitys_decimate_by_)
-
-/**
  * Private implementation for appending.
  *
  * Intended to be shared to each of the different implementation variations.
@@ -57,6 +33,7 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_resize().
  *
  * @see f_memory_resize()
+ *
  * @see f_string_quantitys_append_all()
  * @see f_string_quantityss_append()
  * @see f_string_quantityss_append_all()
@@ -65,32 +42,6 @@ extern "C" {
   extern f_status_t private_f_string_quantitys_append_all(const f_string_quantitys_t source, f_string_quantitys_t * const destination) F_attribute_visibility_internal_d;
 #endif // !defined(_di_f_string_quantitys_append_all_) || !defined(_di_f_string_quantityss_append_) || !defined(_di_f_string_quantityss_append_all_)
 
-/**
- * Private implementation for resizing.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The new size to use.
- * @param quantitys
- *   The quantitys to resize.
- *
- * @return
- *   F_none on success.
- *
- *   F_array_too_large (with error bit) if the combined array is too large.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- * @see f_string_quantitys_decrease_by()
- * @see f_string_quantitys_increase()
- * @see f_string_quantitys_increase_by()
- */
-#if !defined(_di_f_string_quantitys_decrease_by_) || !defined(_di_f_string_quantitys_increase_) || !defined(_di_f_string_quantitys_increase_by_)
-  extern f_status_t private_f_string_quantitys_resize(const f_number_unsigned_t length, f_string_quantitys_t * const quantitys) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_string_quantitys_decrease_by_) || !defined(_di_f_string_quantitys_increase_) || !defined(_di_f_string_quantitys_increase_by_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index 39995b946a59272d958db605224be741aa170713..43e9648ab76ea7da269e450ad31f26782243c65e 100644 (file)
@@ -10,56 +10,30 @@ extern "C" {
 #if !defined(_di_f_string_quantityss_adjust_) || !defined(_di_f_string_quantityss_decimate_by_)
   f_status_t private_f_string_quantityss_adjust(const f_number_unsigned_t length, f_string_quantityss_t * const quantityss) {
 
-    if (quantityss->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < quantityss->size; ++i) {
 
-      status = private_f_string_quantitys_adjust(0, &quantityss->array[i]);
+      status = f_memory_array_adjust(length, sizeof(f_string_quantitys_t), (void **) &quantityss->array[i].array, &quantityss->array[i].used, &quantityss->array[i].size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(quantityss->size, length, sizeof(f_string_quantitys_t), (void **) & quantityss->array);
-    if (F_status_is_error(status)) return status;
-
-    quantityss->size = length;
-
-    if (quantityss->used > quantityss->size) {
-      quantityss->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_quantitys_t), (void **) &quantityss->array, &quantityss->used, &quantityss->size);
   }
 #endif // !defined(_di_f_string_quantityss_adjust_) || !defined(_di_f_string_quantityss_decimate_by_)
 
 #if !defined(_di_f_string_quantityss_decrease_by_) || !defined(_di_f_string_quantityss_increase_) || !defined(_di_f_string_quantityss_increase_by_)
   f_status_t private_f_string_quantityss_resize(const f_number_unsigned_t length, f_string_quantityss_t * const quantityss) {
 
-    if (quantityss->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < quantityss->size; ++i) {
 
-      status = private_f_string_quantitys_resize(0, &quantityss->array[i]);
+      status = f_memory_array_resize(0, sizeof(f_string_quantity_t), (void **) &quantityss->array[i].array, &quantityss->array[i].used, &quantityss->array[i].size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(quantityss->size, length, sizeof(f_string_quantitys_t), (void **) & quantityss->array);
-    if (F_status_is_error(status)) return status;
-
-    quantityss->size = length;
-
-    if (quantityss->used > quantityss->size) {
-      quantityss->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_quantitys_t), (void **) &quantityss->array, &quantityss->used, &quantityss->size);
   }
 #endif // !defined(_di_f_string_quantityss_decrease_by_) || !defined(_di_f_string_quantityss_increase_) || !defined(_di_f_string_quantityss_increase_by_)
 
index ea0d1e30a869f1d21d437adaec23ecc4f572ed77..6900746495c71f846a3cb7f8a10267ce5be31880 100644 (file)
@@ -33,6 +33,7 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_adjust().
  *
  * @see f_memory_adjust()
+ *
  * @see f_string_quantityss_adjust()
  */
 #if !defined(_di_f_string_quantityss_adjust_) || !defined(_di_f_string_quantityss_decimate_by_)
@@ -57,6 +58,7 @@ extern "C" {
  *   Errors (with error bit) from: f_memory_resize().
  *
  * @see f_memory_resize()
+ *
  * @see f_string_quantityss_decrease_by()
  * @see f_string_quantityss_increase()
  * @see f_string_quantityss_increase_by()
index 248f491dd1c9defbbbb75d0fe38c7c28d6d04fe1..c2e48d56d0faae086f40cf096cc937efff925957 100644 (file)
@@ -6,31 +6,11 @@
 extern "C" {
 #endif
 
-#if !defined(_di_f_string_ranges_adjust_) || !defined(_di_f_string_ranges_decimate_by_)
-  f_status_t private_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const ranges) {
-
-    if (ranges->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
-    const f_status_t status = f_memory_adjust(ranges->size, length, sizeof(f_string_range_t), (void **) & ranges->array);
-    if (F_status_is_error(status)) return status;
-
-    ranges->size = length;
-
-    if (ranges->used > ranges->size) {
-      ranges->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_string_ranges_adjust_) || !defined(_di_f_string_ranges_decimate_by_)
-
 #if !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_)
   f_status_t private_f_string_ranges_append_all(const f_string_ranges_t source, f_string_ranges_t * const destination) {
 
     if (destination->used + source.used > destination->size) {
-      const f_status_t status = private_f_string_ranges_resize(destination->used + source.used, destination);
+      const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_string_range_t), (void **) &destination->array, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
@@ -44,26 +24,6 @@ extern "C" {
   }
 #endif // !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_)
 
-#if !defined(_di_f_string_ranges_append_) || !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_resize_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_) || !defined(_di_f_string_rangess_decrease_by_) || !defined(_di_f_string_rangess_increase_) || !defined(_di_f_string_rangess_increase_by_)
-  f_status_t private_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const ranges) {
-
-    if (ranges->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
-    const f_status_t status = f_memory_resize(ranges->size, length, sizeof(f_string_range_t), (void **) & ranges->array);
-    if (F_status_is_error(status)) return status;
-
-    ranges->size = length;
-
-    if (ranges->used > ranges->size) {
-      ranges->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_string_ranges_append_) || !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_resize_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_) || !defined(_di_f_string_rangess_decrease_by_) || !defined(_di_f_string_rangess_increase_) || !defined(_di_f_string_rangess_increase_by_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index d1d3962542e0221fc8e02c128d6bab5d8d240e6e..f63d42ac4de03235201497ce50754b30de1e1448 100644 (file)
@@ -16,30 +16,6 @@ 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 ranges
- *   The ranges to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   F_array_too_large (with error bit) if the combined array is too large.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @see f_string_ranges_adjust()
- */
-#if !defined(_di_f_string_ranges_adjust_) || !defined(_di_f_string_ranges_decimate_by_)
-  extern f_status_t private_f_string_ranges_adjust(const f_number_unsigned_t length, f_string_ranges_t * const ranges) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_string_ranges_adjust_) || !defined(_di_f_string_ranges_decimate_by_)
-
-/**
  * Private implementation for appending.
  *
  * Intended to be shared to each of the different implementation variations.
@@ -65,40 +41,6 @@ extern "C" {
   extern f_status_t private_f_string_ranges_append_all(const f_string_ranges_t source, f_string_ranges_t * const destination) F_attribute_visibility_internal_d;
 #endif // !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_)
 
-/**
- * Private implementation for resizing.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The new size to use.
- * @param ranges
- *   The ranges to resize.
- *
- * @return
- *   F_none on success.
- *
- *   F_array_too_large (with error bit) if the combined array is too large.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- * @see f_string_ranges_append()
- * @see f_string_ranges_append_all()
- * @see f_string_ranges_decrease_by()
- * @see f_string_ranges_increase()
- * @see f_string_ranges_increase_by()
- * @see f_string_ranges_resize()
- * @see f_string_rangess_append()
- * @see f_string_rangess_append_all()
- * @see f_string_rangess_decrease_by()
- * @see f_string_rangess_increase()
- * @see f_string_rangess_increase_by()
- */
-#if !defined(_di_f_string_ranges_append_) || !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_resize_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_) || !defined(_di_f_string_rangess_decrease_by_) || !defined(_di_f_string_rangess_increase_) || !defined(_di_f_string_rangess_increase_by_)
-  extern f_status_t private_f_string_ranges_resize(const f_number_unsigned_t length, f_string_ranges_t * const ranges) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_string_ranges_append_) || !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_resize_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_) || !defined(_di_f_string_rangess_decrease_by_) || !defined(_di_f_string_rangess_increase_) || !defined(_di_f_string_rangess_increase_by_)
-
 #ifdef __cplusplus
 } // extern "C"
 #endif
index b129cafc4821b534242ec6c89a5addc5181f5db5..376f9270d21bff795c5f878ffabaac1327fc1208 100644 (file)
@@ -10,56 +10,30 @@ extern "C" {
 #if !defined(_di_f_string_rangess_adjust_) || !defined(_di_f_string_rangess_decimate_by_)
   f_status_t private_f_string_rangess_adjust(const f_number_unsigned_t length, f_string_rangess_t * const rangess) {
 
-    if (rangess->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < rangess->size; ++i) {
 
-      status = private_f_string_ranges_adjust(0, &rangess->array[i]);
+      status = f_memory_array_adjust(0, sizeof(f_string_range_t), (void **) &rangess->array[i].array, &rangess->array[i].used, &rangess->array[i].size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(rangess->size, length, sizeof(f_string_ranges_t), (void **) & rangess->array);
-    if (F_status_is_error(status)) return status;
-
-    rangess->size = length;
-
-    if (rangess->used > rangess->size) {
-      rangess->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_ranges_t), (void **) &rangess->array, &rangess->used, &rangess->size);
   }
 #endif // !defined(_di_f_string_rangess_adjust_) || !defined(_di_f_string_rangess_decimate_by_)
 
 #if !defined(_di_f_string_ranges_append_) || !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_resize_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_) || !defined(_di_f_string_rangess_decrease_by_) || !defined(_di_f_string_rangess_increase_) || !defined(_di_f_string_rangess_increase_by_)
   f_status_t private_f_string_rangess_resize(const f_number_unsigned_t length, f_string_rangess_t * const rangess) {
 
-    if (rangess->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < rangess->size; ++i) {
 
-      status = private_f_string_ranges_resize(0, &rangess->array[i]);
+      status = f_memory_array_resize(0, sizeof(f_string_range_t), (void **) &rangess->array[i].array, &rangess->array[i].used, &rangess->array[i].size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(rangess->size, length, sizeof(f_string_ranges_t), (void **) & rangess->array);
-    if (F_status_is_error(status)) return status;
-
-    rangess->size = length;
-
-    if (rangess->used > rangess->size) {
-      rangess->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_ranges_t), (void **) &rangess->array, &rangess->used, &rangess->size);
   }
 #endif // !defined(_di_f_string_ranges_append_) || !defined(_di_f_string_ranges_append_all_) || !defined(_di_f_string_ranges_decrease_by_) || !defined(_di_f_string_ranges_increase_) || !defined(_di_f_string_ranges_increase_by_) || !defined(_di_f_string_ranges_resize_) || !defined(_di_f_string_rangess_append_) || !defined(_di_f_string_rangess_append_all_) || !defined(_di_f_string_rangess_decrease_by_) || !defined(_di_f_string_rangess_increase_) || !defined(_di_f_string_rangess_increase_by_)
 
index 8da8f503341ea176b612dd65f965f01cd4eb9c21..6512048479bb6afff0b75d431d1064503c523433 100644 (file)
@@ -10,34 +10,21 @@ extern "C" {
 #if !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_)
   f_status_t private_f_string_triples_adjust(const f_number_unsigned_t length, f_string_triples_t * const triples) {
 
-    if (triples->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < triples->size; ++i) {
 
-      status = private_f_string_dynamic_adjust(0, &triples->array[i].a);
+      status = f_memory_array_adjust(0, sizeof(f_string_triple_t), (void **) &triples->array[i].a.string, &triples->array[i].a.used, &triples->array[i].a.size);
       if (F_status_is_error(status)) return status;
 
-      status = private_f_string_dynamic_adjust(0, &triples->array[i].b);
+      status = f_memory_array_adjust(0, sizeof(f_string_triple_t), (void **) &triples->array[i].b.string, &triples->array[i].b.used, &triples->array[i].b.size);
       if (F_status_is_error(status)) return status;
 
-      status = private_f_string_dynamic_adjust(0, &triples->array[i].c);
+      status = f_memory_array_adjust(0, sizeof(f_string_triple_t), (void **) &triples->array[i].c.string, &triples->array[i].c.used, &triples->array[i].c.size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(triples->size, length, sizeof(f_string_triple_t), (void **) & triples->array);
-    if (F_status_is_error(status)) return status;
-
-    triples->size = length;
-
-    if (triples->used > triples->size) {
-      triples->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_triple_t), (void **) &triples->array, &triples->used, &triples->size);
   }
 #endif // !defined(_di_f_string_triples_adjust_) || !defined(_di_f_string_triples_decimate_by_)
 
@@ -80,34 +67,21 @@ extern "C" {
 #if !defined(_di_f_string_triples_decrease_by_) || !defined(_di_f_string_triples_increase_) || !defined(_di_f_string_triples_increase_by_)
   f_status_t private_f_string_triples_resize(const f_number_unsigned_t length, f_string_triples_t * const triples) {
 
-    if (triples->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < triples->size; ++i) {
 
-      status = private_f_string_dynamic_resize(0, &triples->array[i].a);
+      status = f_memory_array_resize(0, sizeof(f_string_triple_t), (void **) &triples->array[i].a.string, &triples->array[i].a.used, &triples->array[i].a.size);
       if (F_status_is_error(status)) return status;
 
-      status = private_f_string_dynamic_resize(0, &triples->array[i].b);
+      status = f_memory_array_resize(0, sizeof(f_string_triple_t), (void **) &triples->array[i].b.string, &triples->array[i].b.used, &triples->array[i].b.size);
       if (F_status_is_error(status)) return status;
 
-      status = private_f_string_dynamic_resize(0, &triples->array[i].c);
+      status = f_memory_array_resize(0, sizeof(f_string_triple_t), (void **) &triples->array[i].c.string, &triples->array[i].c.used, &triples->array[i].c.size);
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(triples->size, length, sizeof(f_string_triple_t), (void **) & triples->array);
-    if (F_status_is_error(status)) return status;
-
-    triples->size = length;
-
-    if (triples->used > triples->size) {
-      triples->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_triple_t), (void **) &triples->array, &triples->used, &triples->size);
   }
 #endif // !defined(_di_f_string_triples_decrease_by_) || !defined(_di_f_string_triples_increase_) || !defined(_di_f_string_triples_increase_by_)
 
index 11407878b2de1e73dfa46cd1e59fe4c49d408ca9..fb553ac3063b47319b493f696561309cc7e4f1c5 100644 (file)
@@ -45,7 +45,7 @@ extern "C" {
  * Intended to be shared to each of the different implementation variations.
  *
  * @param source
- *   The source triples to append.
+ *   The source destination to append.
  * @param destination
  *   The destination triples the source is appended onto.
  *
index 7061fc684389fd42b9e7aff825357d51b2a7c704..24eca7339fd3e7983e75e3b7288569e8f6628f68 100644 (file)
@@ -11,10 +11,6 @@ extern "C" {
 #if !defined(_di_f_string_tripless_adjust_) || !defined(_di_f_string_tripless_decimate_by_)
   f_status_t private_f_string_tripless_adjust(const f_number_unsigned_t length, f_string_tripless_t * const tripless) {
 
-    if (tripless->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < tripless->size; ++i) {
@@ -23,26 +19,13 @@ extern "C" {
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_adjust(tripless->size, length, sizeof(f_string_triples_t), (void **) & tripless->array);
-    if (F_status_is_error(status)) return status;
-
-    tripless->size = length;
-
-    if (tripless->used > tripless->size) {
-      tripless->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_adjust(length, sizeof(f_string_triples_t), (void **) &tripless->array, &tripless->used, &tripless->size);
   }
 #endif // !defined(_di_f_string_tripless_adjust_) || !defined(_di_f_string_tripless_decimate_by_)
 
 #if !defined(_di_f_string_tripless_decrease_by_) || !defined(_di_f_string_tripless_increase_) || !defined(_di_f_string_tripless_increase_by_)
   f_status_t private_f_string_tripless_resize(const f_number_unsigned_t length, f_string_tripless_t * const tripless) {
 
-    if (tripless->used + length > F_number_t_size_unsigned_d) {
-      return F_status_set_error(F_array_too_large);
-    }
-
     f_status_t status = F_none;
 
     for (f_number_unsigned_t i = length; i < tripless->size; ++i) {
@@ -51,16 +34,7 @@ extern "C" {
       if (F_status_is_error(status)) return status;
     } // for
 
-    status = f_memory_resize(tripless->size, length, sizeof(f_string_triples_t), (void **) & tripless->array);
-    if (F_status_is_error(status)) return status;
-
-    tripless->size = length;
-
-    if (tripless->used > tripless->size) {
-      tripless->used = length;
-    }
-
-    return F_none;
+    return f_memory_array_resize(length, sizeof(f_string_triples_t), (void **) &tripless->array, &tripless->used, &tripless->size);
   }
 #endif // !defined(_di_f_string_tripless_decrease_by_) || !defined(_di_f_string_tripless_increase_) || !defined(_di_f_string_tripless_increase_by_)
 
index 0c9289e667110d2edb161234f119f7e78882a5ea..d1403ee76c9d46cd466f6fa783b3a0cb6aaced20 100644 (file)
@@ -12,7 +12,7 @@ extern "C" {
       if (!quantitys) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_string_quantitys_adjust(length, quantitys);
+    return f_memory_array_adjust(length, sizeof(f_string_quantity_t), (void **) &quantitys->array, &quantitys->used, &quantitys->size);
   }
 #endif // _di_f_string_quantitys_adjust_
 
@@ -23,7 +23,7 @@ extern "C" {
     #endif // _di_level_0_parameter_checking_
 
     if (destination->used + 1 > destination->size) {
-      const f_status_t status = private_f_string_quantitys_resize(destination->used + F_memory_default_allocation_small_d, destination);
+      const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_string_quantity_t), (void **) &destination->array, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
@@ -52,13 +52,7 @@ extern "C" {
       if (!quantitys) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
-
-    if (quantitys->size > amount) {
-      return private_f_string_quantitys_adjust(quantitys->size - amount, quantitys);
-    }
-
-    return private_f_string_quantitys_adjust(0, quantitys);
+    return f_memory_array_decimate_by(amount, sizeof(f_string_quantity_t), (void **) &quantitys->array, &quantitys->used, &quantitys->size);
   }
 #endif // _di_f_string_quantitys_decimate_by_
 
@@ -68,13 +62,8 @@ extern "C" {
       if (!quantitys) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
-
-    if (quantitys->size > amount) {
-      return private_f_string_quantitys_resize(quantitys->size - amount, quantitys);
-    }
 
-    return private_f_string_quantitys_resize(0, quantitys);
+    return f_memory_array_decrease_by(amount, sizeof(f_string_quantity_t), (void **) &quantitys->array, &quantitys->used, &quantitys->size);
   }
 #endif // _di_f_string_quantitys_decrease_by_
 
@@ -84,21 +73,7 @@ extern "C" {
       if (!quantitys) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (step && quantitys->used + 1 > quantitys->size) {
-      f_number_unsigned_t size = quantitys->used + step;
-
-      if (size > F_number_t_size_unsigned_d) {
-        if (quantitys->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
-
-        size = F_number_t_size_unsigned_d;
-      }
-
-      return private_f_string_quantitys_resize(size, quantitys);
-    }
-
-    return F_data_not;
+    return f_memory_array_increase(step, sizeof(f_string_quantity_t), (void **) &quantitys->array, &quantitys->used, &quantitys->size);
   }
 #endif // _di_f_string_quantitys_increase_
 
@@ -108,19 +83,7 @@ extern "C" {
       if (!quantitys) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (amount) {
-      if (quantitys->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-      const f_number_unsigned_t length = quantitys->used + amount;
-
-      if (length > quantitys->size) {
-        if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-        return private_f_string_quantitys_resize(length, quantitys);
-      }
-    }
-
-    return F_data_not;
+    return f_memory_array_increase_by(amount, sizeof(f_string_quantity_t), (void **) &quantitys->array, &quantitys->used, &quantitys->size);
   }
 #endif // _di_f_string_quantitys_increase_by_
 
@@ -130,7 +93,7 @@ extern "C" {
       if (!quantitys) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_string_quantitys_resize(length, quantitys);
+    return f_memory_array_resize(length, sizeof(f_string_quantity_t), (void **) &quantitys->array, &quantitys->used, &quantitys->size);
   }
 #endif // _di_f_string_quantitys_resize_
 
index 261acb2a7bbef8ccd6f8f94695c89915f47aa095..07c695047c08efb03eae7ea4cd6efc6c382a0a93 100644 (file)
@@ -82,11 +82,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (quantityss->size > amount) {
-      return private_f_string_quantityss_adjust(quantityss->size - amount, quantityss);
-    }
-
-    return private_f_string_quantityss_adjust(0, quantityss);
+    return private_f_string_quantityss_adjust((quantityss->size > amount) ? quantityss->size - amount : 0, quantityss);
   }
 #endif // _di_f_string_quantityss_decimate_by_
 
@@ -98,11 +94,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (quantityss->size > amount) {
-      return private_f_string_quantityss_resize(quantityss->size - amount, quantityss);
-    }
-
-    return private_f_string_quantityss_resize(0, quantityss);
+    return private_f_string_quantityss_resize((quantityss->size > amount) ? quantityss->size - amount : 0, quantityss);
   }
 #endif // _di_f_string_quantityss_decrease_by_
 
@@ -116,9 +108,7 @@ extern "C" {
       f_number_unsigned_t size = quantityss->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (quantityss->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (quantityss->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index 19678ca9f2849c79450f0ba0189c2d23510469e1..aedd32e83f3bb9a819ff80e83f5ccb8dcc47a59b 100644 (file)
@@ -12,7 +12,7 @@ extern "C" {
       if (!ranges) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_string_ranges_adjust(length, ranges);
+    return f_memory_array_adjust(length, sizeof(f_string_range_t), (void **) &ranges->array, &ranges->used, &ranges->size);
   }
 #endif // _di_f_string_ranges_adjust_
 
@@ -22,8 +22,8 @@ extern "C" {
       if (!destination) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (destination->used + 1 > destination->size) {
-      const f_status_t status = private_f_string_ranges_resize(destination->used + F_memory_default_allocation_small_d, destination);
+    {
+      const f_status_t status = f_memory_array_increase(F_memory_default_allocation_small_d, sizeof(f_string_range_t), (void **) &destination->array, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
@@ -42,8 +42,8 @@ extern "C" {
 
     if (!source.used) return F_data_not;
 
-    if (destination->used + source.used > destination->size) {
-      const f_status_t status = private_f_string_ranges_resize(destination->used + source.used, destination);
+    {
+      const f_status_t status = f_memory_array_increase_by(source.used, sizeof(f_string_range_t), (void **) &destination->array, &destination->used, &destination->size);
       if (F_status_is_error(status)) return status;
     }
 
@@ -65,11 +65,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (ranges->size > amount) {
-      return private_f_string_ranges_adjust(ranges->size - amount, ranges);
-    }
-
-    return private_f_string_ranges_adjust(0, ranges);
+    return f_memory_array_decimate_by(amount, sizeof(f_string_range_t), (void **) &ranges->array, &ranges->used, &ranges->size);
   }
 #endif // _di_f_string_ranges_decimate_by_
 
@@ -79,13 +75,7 @@ extern "C" {
       if (!ranges) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (!amount) return F_data_not;
-
-    if (ranges->size > amount) {
-      return private_f_string_ranges_resize(ranges->size - amount, ranges);
-    }
-
-    return private_f_string_ranges_resize(0, ranges);
+    return f_memory_array_decrease_by(amount, sizeof(f_string_range_t), (void **) &ranges->array, &ranges->used, &ranges->size);
   }
 #endif // _di_f_string_ranges_decrease_by_
 
@@ -95,21 +85,7 @@ extern "C" {
       if (!ranges) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (step && ranges->used + 1 > ranges->size) {
-      f_number_unsigned_t size = ranges->used + step;
-
-      if (size > F_number_t_size_unsigned_d) {
-        if (ranges->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
-
-        size = F_number_t_size_unsigned_d;
-      }
-
-      return private_f_string_ranges_resize(size, ranges);
-    }
-
-    return F_data_not;
+    return f_memory_array_increase(step, sizeof(f_string_range_t), (void **) &ranges->array, &ranges->used, &ranges->size);
   }
 #endif // _di_f_string_ranges_increase_
 
@@ -119,19 +95,7 @@ extern "C" {
       if (!ranges) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (amount) {
-      if (ranges->used >= F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-      const f_number_unsigned_t length = ranges->used + amount;
-
-      if (length > ranges->size) {
-        if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
-
-        return private_f_string_ranges_resize(length, ranges);
-      }
-    }
-
-    return F_data_not;
+    return f_memory_array_increase_by(amount, sizeof(f_string_range_t), (void **) &ranges->array, &ranges->used, &ranges->size);
   }
 #endif // _di_f_string_ranges_increase_by_
 
@@ -141,7 +105,7 @@ extern "C" {
       if (!ranges) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    return private_f_string_ranges_resize(length, ranges);
+    return f_memory_array_resize(length, sizeof(f_string_range_t), (void **) &ranges->array, &ranges->used, &ranges->size);
   }
 #endif // _di_f_string_ranges_resize_
 
index 026da0b4b6d6ff35f13bce4954671b78ec5b1106..324739c9214dc8f51968524b3b1fe93df740d565 100644 (file)
@@ -82,11 +82,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (rangess->size > amount) {
-      return private_f_string_rangess_adjust(rangess->size - amount, rangess);
-    }
-
-    return private_f_string_rangess_adjust(0, rangess);
+    return private_f_string_rangess_adjust((rangess->size > amount) ? rangess->size - amount : 0, rangess);
   }
 #endif // _di_f_string_rangess_decimate_by_
 
@@ -98,11 +94,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (rangess->size > amount) {
-      return private_f_string_rangess_resize(rangess->size - amount, rangess);
-    }
-
-    return private_f_string_rangess_resize(0, rangess);
+    return private_f_string_rangess_resize((rangess->size > amount) ? rangess->size - amount : 0, rangess);
   }
 #endif // _di_f_string_rangess_decrease_by_
 
@@ -116,9 +108,7 @@ extern "C" {
       f_number_unsigned_t size = rangess->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (rangess->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (rangess->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index c65e00bcf6d8fa4bb0bc518b93c5130ebfd5f059..39ea8dedb0cd02085a645f76b02d4480b16d699c 100644 (file)
@@ -101,11 +101,9 @@ extern "C" {
       if (!triples) return F_status_set_error(F_parameter);
     #endif // _di_level_0_parameter_checking_
 
-    if (triples->size > amount) {
-      return private_f_string_triples_adjust(triples->size - amount, triples);
-    }
+    if (!amount) return F_data_not;
 
-    return private_f_string_triples_adjust(0, triples);
+    return private_f_string_triples_adjust((triples->size > amount) ? triples->size - amount : 0, triples);
   }
 #endif // _di_f_string_triples_decimate_by_
 
@@ -117,11 +115,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (triples->size > amount) {
-      return private_f_string_triples_resize(triples->size - amount, triples);
-    }
-
-    return private_f_string_triples_resize(0, triples);
+    return private_f_string_triples_resize((triples->size > amount) ? triples->size - amount : 0, triples);
   }
 #endif // _di_f_string_triples_decrease_by_
 
@@ -135,9 +129,7 @@ extern "C" {
       f_number_unsigned_t size = triples->used + F_memory_default_allocation_small_d;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (triples->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (triples->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index d1cee998dd23c961eeb99e0aef536d3c3ecf0f5b..196f172490118f4a50ede9da935cd01123606fff 100644 (file)
@@ -82,11 +82,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (tripless->size > amount) {
-      return private_f_string_tripless_adjust(tripless->size - amount, tripless);
-    }
-
-    return private_f_string_tripless_adjust(0, tripless);
+    return private_f_string_tripless_adjust((tripless->size > amount) ? tripless->size - amount : 0, tripless);
   }
 #endif // _di_f_string_tripless_decimate_by_
 
@@ -98,11 +94,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (tripless->size > amount) {
-      return private_f_string_tripless_resize(tripless->size - amount, tripless);
-    }
-
-    return private_f_string_tripless_resize(0, tripless);
+    return private_f_string_tripless_resize((tripless->size > amount) ? tripless->size - amount : 0, tripless);
   }
 #endif // _di_f_string_tripless_decrease_by_
 
@@ -116,9 +108,7 @@ extern "C" {
       f_number_unsigned_t size = tripless->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (tripless->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (tripless->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
diff --git a/level_0/f_thread/c/private-thread.c b/level_0/f_thread/c/private-thread.c
deleted file mode 100644 (file)
index 974c774..0000000
+++ /dev/null
@@ -1,896 +0,0 @@
-#include "thread.h"
-#include "private-thread.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 *attribute) {
-
-    if (pthread_attr_destroy(attribute)) {
-      return F_status_set_error(F_failure);
-    }
-
-    attribute = 0;
-
-    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
-
-    status = f_memory_adjust(attributes->size, length, sizeof(f_thread_attribute_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#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
-
-    status = f_memory_resize(attributes->size, length, sizeof(f_thread_attribute_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#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_)
-
-#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_)
-  f_status_t private_f_thread_barrier_delete(f_thread_barrier_t *barrier) {
-
-    const int error = pthread_barrier_destroy(barrier);
-
-    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);
-    }
-
-    barrier = 0;
-
-    return F_none;
-  }
-#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_)
-
-#if !defined(_di_f_thread_barriers_adjust_) || !defined(_di_f_thread_barriers_decimate_by_)
-  f_status_t private_f_thread_barriers_adjust(const f_number_unsigned_t length, f_thread_barriers_t * const barriers) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < barriers->size; ++i) {
-
-      status = private_f_thread_barrier_delete(&barriers->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(barriers->size, length, sizeof(f_thread_barrier_t), (void **) & barriers->array);
-    if (F_status_is_error(status)) return status;
-
-    barriers->size = length;
-
-    if (barriers->used > barriers->size) {
-      barriers->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_barriers_adjust_) || !defined(_di_f_thread_barriers_decimate_by_)
-
-#if !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_)
-  f_status_t private_f_thread_barriers_resize(const f_number_unsigned_t length, f_thread_barriers_t * const barriers) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < barriers->size; ++i) {
-
-      status = private_f_thread_barrier_delete(&barriers->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(barriers->size, length, sizeof(f_thread_barrier_t), (void **) & barriers->array);
-    if (F_status_is_error(status)) return status;
-
-    barriers->size = length;
-
-    if (barriers->used > barriers->size) {
-      barriers->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !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_)
-
-#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_)
-  f_status_t private_f_thread_barrier_attribute_delete(f_thread_barrier_attribute_t *attribute) {
-
-    if (pthread_barrierattr_destroy(attribute)) {
-      return F_status_set_error(F_failure);
-    }
-
-    attribute = 0;
-
-    return F_none;
-  }
-#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_)
-
-#if !defined(_di_f_thread_barrier_attributes_adjust_) || !defined(_di_f_thread_barrier_attributes_decimate_by_)
-  f_status_t private_f_thread_barrier_attributes_adjust(const f_number_unsigned_t length, f_thread_barrier_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_barrier_attribute_delete(&attributes->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(attributes->size, length, sizeof(f_thread_barrier_attribute_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_barrier_attributes_adjust_) || !defined(_di_f_thread_barrier_attributes_decimate_by_)
-
-#if !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_)
-  f_status_t private_f_thread_barrier_attributes_resize(const f_number_unsigned_t length, f_thread_barrier_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_barrier_attribute_delete(&attributes->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(attributes->size, length, sizeof(f_thread_barrier_attribute_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !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_)
-
-#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_)
-  f_status_t private_f_thread_condition_attribute_delete(f_thread_condition_attribute_t * const attribute) {
-
-    const int error = pthread_condattr_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 // !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_)
-
-#if !defined(_di_f_thread_condition_attributes_adjust_) || !defined(_di_f_thread_condition_attributes_decimate_by_)
-  f_status_t private_f_thread_condition_attributes_adjust(const f_number_unsigned_t length, f_thread_condition_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_condition_attribute_delete(&attributes->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(attributes->size, length, sizeof(f_thread_condition_attribute_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_condition_attributes_adjust_) || !defined(_di_f_thread_condition_attributes_decimate_by_)
-
-#if !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_)
-  f_status_t private_f_thread_condition_attributes_resize(const f_number_unsigned_t length, f_thread_condition_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_condition_attribute_delete(&attributes->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(attributes->size, length, sizeof(f_thread_condition_attribute_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !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_)
-
-#if !defined(_di_f_thread_condition_delete_) || !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_) || !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_) || !defined(_di_f_thread_conditions_resize_)
-  f_status_t private_f_thread_condition_delete(f_thread_condition_t *condition) {
-
-    const int error = pthread_cond_destroy(condition);
-
-    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_condition_delete_) || !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_) || !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_) || !defined(_di_f_thread_conditions_resize_)
-
-#if !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_)
-  f_status_t private_f_thread_conditions_adjust(const f_number_unsigned_t length, f_thread_conditions_t * const conditions) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < conditions->size; ++i) {
-
-      status = private_f_thread_condition_delete(&conditions->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(conditions->size, length, sizeof(f_thread_condition_t), (void **) & conditions->array);
-    if (F_status_is_error(status)) return status;
-
-    conditions->size = length;
-
-    if (conditions->used > conditions->size) {
-      conditions->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_)
-
-#if !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_)
-  f_status_t private_f_thread_conditions_resize(const f_number_unsigned_t length, f_thread_conditions_t * const conditions) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < conditions->size; ++i) {
-
-      status = private_f_thread_condition_delete(&conditions->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(conditions->size, length, sizeof(f_thread_condition_t), (void **) & conditions->array);
-    if (F_status_is_error(status)) return status;
-
-    conditions->size = length;
-
-    if (conditions->used > conditions->size) {
-      conditions->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_)
-
-#if !defined(_di_f_thread_ids_adjust_) || !defined(_di_f_thread_ids_decimate_by_)
-  f_status_t private_f_thread_ids_adjust(const f_number_unsigned_t length, f_thread_ids_t * const ids) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < ids->size; ++i) {
-      memset(&ids->array[i], 0, sizeof(f_thread_id_t));
-    } // for
-
-    status = f_memory_adjust(ids->size, length, sizeof(f_thread_id_t), (void **) & ids->array);
-    if (F_status_is_error(status)) return status;
-
-    ids->size = length;
-
-    if (ids->used > ids->size) {
-      ids->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_ids_adjust_) || !defined(_di_f_thread_ids_decimate_by_)
-
-#if !defined(_di_f_thread_ids_decrease_) || !defined(_di_f_thread_ids_decrease_by_) || !defined(_di_f_thread_ids_increase_) || !defined(_di_f_thread_ids_increase_by_)
-  f_status_t private_f_thread_ids_resize(const f_number_unsigned_t length, f_thread_ids_t * const ids) {
-
-    const f_status_t status = f_memory_resize(ids->size, length, sizeof(f_thread_id_t), (void **) & ids->array);
-    if (F_status_is_error(status)) return status;
-
-    ids->size = length;
-
-    if (ids->used > ids->size) {
-      ids->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_ids_decrease_) || !defined(_di_f_thread_ids_decrease_by_) || !defined(_di_f_thread_ids_increase_) || !defined(_di_f_thread_ids_increase_by_)
-
-#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 *key) {
-
-    if (pthread_key_delete(*key)) {
-      return F_status_set_error(F_failure);
-    }
-
-    *key = 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 keys) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < keys->size; ++i) {
-
-      status = private_f_thread_key_delete(&keys->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(keys->size, length, sizeof(f_thread_key_t), (void **) & keys->array);
-    if (F_status_is_error(status)) return status;
-
-    keys->size = length;
-
-    if (keys->used > keys->size) {
-      keys->used = length;
-    }
-
-    return F_none;
-  }
-#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 keys) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < keys->size; ++i) {
-
-      status = private_f_thread_key_delete(&keys->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(keys->size, length, sizeof(f_thread_key_t), (void **) & keys->array);
-    if (F_status_is_error(status)) return status;
-
-    keys->size = length;
-
-    if (keys->used > keys->size) {
-      keys->used = length;
-    }
-
-    return F_none;
-  }
-#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_)
-
-#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 *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 // !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 attributes) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < attributes->size; ++i) {
-
-      status = private_f_thread_lock_attribute_delete(&attributes->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(attributes->size, length, sizeof(f_thread_lock_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#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 attributes) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < attributes->size; ++i) {
-
-      status = private_f_thread_lock_attribute_delete(&attributes->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(attributes->size, length, sizeof(f_thread_lock_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#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_)
-
-#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 *lock) {
-
-    const 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 // !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 locks) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < locks->size; ++i) {
-
-      status = private_f_thread_lock_delete(&locks->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(locks->size, length, sizeof(f_thread_lock_t), (void **) & locks->array);
-    if (F_status_is_error(status)) return status;
-
-    locks->size = length;
-
-    if (locks->used > locks->size) {
-      locks->used = length;
-    }
-
-    return F_none;
-  }
-#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 locks) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < locks->size; ++i) {
-
-      status = private_f_thread_lock_delete(&locks->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(locks->size, length, sizeof(f_thread_lock_t), (void **) & locks->array);
-    if (F_status_is_error(status)) return status;
-
-    locks->size = length;
-
-    if (locks->used > locks->size) {
-      locks->used = length;
-    }
-
-    return F_none;
-  }
-#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_)
-
-#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 *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 // !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 attributes) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < attributes->size; ++i) {
-
-      status = private_f_thread_mutex_attribute_delete(&attributes->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(attributes->size, length, sizeof(f_thread_mutex_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#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 attributes) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < attributes->size; ++i) {
-
-      status = private_f_thread_mutex_attribute_delete(&attributes->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(attributes->size, length, sizeof(f_thread_mutex_t), (void **) & attributes->array);
-    if (F_status_is_error(status)) return status;
-
-    attributes->size = length;
-
-    if (attributes->used > attributes->size) {
-      attributes->used = length;
-    }
-
-    return F_none;
-  }
-#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_)
-
-
-#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 *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 // !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 mutexs) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < mutexs->size; ++i) {
-
-      status = private_f_thread_mutex_delete(&mutexs->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(mutexs->size, length, sizeof(f_thread_mutex_t), (void **) & mutexs->array);
-    if (F_status_is_error(status)) return status;
-
-    mutexs->size = length;
-
-    if (mutexs->used > mutexs->size) {
-      mutexs->used = length;
-    }
-
-    return F_none;
-  }
-#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 mutexs) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < mutexs->size; ++i) {
-
-      status = private_f_thread_mutex_delete(&mutexs->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(mutexs->size, length, sizeof(f_thread_mutex_t), (void **) & mutexs->array);
-    if (F_status_is_error(status)) return status;
-
-    mutexs->size = length;
-
-    if (mutexs->used > mutexs->size) {
-      mutexs->used = length;
-    }
-
-    return F_none;
-  }
-#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_)
-
-#if !defined(_di_f_thread_onces_adjust_) || !defined(_di_f_thread_onces_decimate_by_)
-  f_status_t private_f_thread_onces_adjust(const f_number_unsigned_t length, f_thread_onces_t * const onces) {
-
-    for (f_number_unsigned_t i = length; i < onces->size; ++i) {
-      memset(&onces->array[i], 0, sizeof(f_thread_once_t));
-    } // for
-
-    const f_status_t status = f_memory_adjust(onces->size, length, sizeof(f_thread_once_t), (void **) & onces->array);
-    if (F_status_is_error(status)) return status;
-
-    onces->size = length;
-
-    if (onces->used > onces->size) {
-      onces->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_onces_adjust_) || !defined(_di_f_thread_onces_decimate_by_)
-
-#if !defined(_di_f_thread_onces_decrease_) || !defined(_di_f_thread_onces_decrease_by_) || !defined(_di_f_thread_onces_increase_) || !defined(_di_f_thread_onces_increase_by_)
-  f_status_t private_f_thread_onces_resize(const f_number_unsigned_t length, f_thread_onces_t * const onces) {
-
-    f_status_t status = F_none;
-
-    status = f_memory_resize(onces->size, length, sizeof(f_thread_once_t), (void **) & onces->array);
-    if (F_status_is_error(status)) return status;
-
-    onces->size = length;
-
-    if (onces->used > onces->size) {
-      onces->used = length;
-    }
-
-    return F_none;
-  }
-#endif // !defined(_di_f_thread_onces_decrease_) || !defined(_di_f_thread_onces_decrease_by_) || !defined(_di_f_thread_onces_increase_) || !defined(_di_f_thread_onces_increase_by_)
-
-#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 *semaphore) {
-
-    const int result = sem_destroy(semaphore);
-
-    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 semaphores) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < semaphores->size; ++i) {
-
-      status = private_f_thread_semaphore_delete(&semaphores->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(semaphores->size, length, sizeof(f_thread_semaphore_t), (void **) & semaphores->array);
-
-    if (F_status_is_error_not(status)) {
-      semaphores->size = length;
-
-      if (semaphores->used > semaphores->size) {
-        semaphores->used = length;
-      }
-    }
-
-    return status;
-  }
-#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 semaphores) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < semaphores->size; ++i) {
-
-      status = private_f_thread_semaphore_delete(&semaphores->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(semaphores->size, length, sizeof(f_thread_semaphore_t), (void **) & semaphores->array);
-    if (F_status_is_error(status)) return status;
-
-    semaphores->size = length;
-
-    if (semaphores->used > semaphores->size) {
-      semaphores->used = length;
-    }
-
-    return F_none;
-  }
-#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_)
-
-#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 sets) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < sets->size; ++i) {
-
-      status = private_f_thread_attribute_delete(&sets->array[i].attribute);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(sets->size, length, sizeof(f_thread_set_t), (void **) & sets->array);
-    if (F_status_is_error(status)) return status;
-
-    sets->size = length;
-
-    if (sets->used > sets->size) {
-      sets->used = length;
-    }
-
-    return F_none;
-  }
-#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 sets) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < sets->size; ++i) {
-
-      status = private_f_thread_attribute_delete(&sets->array[i].attribute);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(sets->size, length, sizeof(f_thread_set_t), (void **) & sets->array);
-    if (F_status_is_error(status)) return status;
-
-    sets->size = length;
-
-    if (sets->used > sets->size) {
-      sets->used = length;
-    }
-
-    return F_none;
-  }
-#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_)
-
-#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 *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 // !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 spins) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < spins->size; ++i) {
-
-      status = private_f_thread_spin_delete(&spins->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_adjust(spins->size, length, sizeof(f_thread_spin_t), (void **) & spins->array);
-    if (F_status_is_error(status)) return status;
-
-    spins->size = length;
-
-    if (spins->used > spins->size) {
-      spins->used = length;
-    }
-
-    return F_none;
-  }
-#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 spins) {
-
-    f_status_t status = F_none;
-
-    for (f_number_unsigned_t i = length; i < spins->size; ++i) {
-
-      status = private_f_thread_spin_delete(&spins->array[i]);
-      if (F_status_is_error(status)) return status;
-    } // for
-
-    status = f_memory_resize(spins->size, length, sizeof(f_thread_spin_t), (void **) & spins->array);
-    if (F_status_is_error(status)) return status;
-
-    spins->size = length;
-
-    if (spins->used > spins->size) {
-      spins->used = length;
-    }
-
-    return F_none;
-  }
-#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/private-thread.h b/level_0/f_thread/c/private-thread.h
deleted file mode 100644 (file)
index 4472d29..0000000
+++ /dev/null
@@ -1,1094 +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_h
-#define _PRIVATE_F_thread_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 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_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 *attribute) 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_adjust().
- *
- * @see f_memory_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_)
-
-/**
- * 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 conditions
- *   The conditions 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_cond_destroy()
- *
- * @see f_thread_condition_delete()
- * @see f_thread_conditions_adjust()
- * @see f_thread_conditions_decimate_by()
- * @see f_thread_conditions_decrease()
- * @see f_thread_conditions_decrease_by()
- * @see f_thread_conditions_increase()
- * @see f_thread_conditions_increase_by()
- * @see f_thread_conditions_resize()
- */
-#if !defined(_di_f_thread_condition_delete_) || !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_) || !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_) || !defined(_di_f_thread_conditions_resize_)
-  extern f_status_t private_f_thread_condition_delete(f_thread_condition_t *condition) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_thread_condition_delete_) || !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_) || !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_) || !defined(_di_f_thread_conditions_resize_)
-
-/**
- * Private implementation for resizing.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The new size to use.
- * @param conditions
- *   The conditions to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @see f_thread_conditions_adjust()
- * @see f_thread_conditions_decimate_by()
- */
-#if !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_)
-  extern f_status_t private_f_thread_conditions_adjust(const f_number_unsigned_t length, f_thread_conditions_t * const conditions) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_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 conditions
- *   The conditions to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- * @see f_thread_conditions_decrease_by()
- * @see f_thread_conditions_increase()
- * @see f_thread_conditions_increase_by()
- */
-#if !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_)
-  extern f_status_t private_f_thread_conditions_resize(const f_number_unsigned_t length, f_thread_conditions_t * const conditions) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_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 ids
- *   The ids to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @see f_thread_ids_adjust()
- * @see f_thread_ids_decimate_by()
- */
-#if !defined(_di_f_thread_ids_adjust_) || !defined(_di_f_thread_ids_decimate_by_)
-  extern f_status_t private_f_thread_ids_adjust(const f_number_unsigned_t length, f_thread_ids_t * const ids) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_thread_ids_adjust_) || !defined(_di_f_thread_ids_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 ids
- *   The ids to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- * @see f_thread_ids_decrease_by()
- * @see f_thread_ids_increase()
- * @see f_thread_ids_increase_by()
- */
-#if !defined(_di_f_thread_ids_decrease_by_) || !defined(_di_f_thread_ids_increase_) || !defined(_di_f_thread_ids_increase_by_)
-  extern f_status_t private_f_thread_ids_resize(const f_number_unsigned_t length, f_thread_ids_t * const ids) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_thread_ids_decrease_by_) || !defined(_di_f_thread_ids_increase_) || !defined(_di_f_thread_ids_increase_by_)
-
-/**
- * Private implementation for deleting (and destroying).
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param key
- *   The keys 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 *key) 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 keys
- *   The keys to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @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 keys) 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 keys
- *   The keys to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_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 keys) 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_)
-
-/**
- * Private implementation for deleting (and destroying).
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param attribute
- *   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 *attribute) 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 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_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 attributes) 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 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_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 attributes) 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_)
-
-/**
- * Private implementation for deleting (and destroying).
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param lock
- *   The locks 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 *lock) 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 locks
- *   The locks to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @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 locks) 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 locks
- *   The locks to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_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 locks) 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_)
-/**
- * Private implementation for deleting (and destroying).
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param attribute
- *   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 *attribute) 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 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_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 attributes) 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 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_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 attributes) 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_)
-
-/**
- * Private implementation for deleting (and destroying).
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param mutex
- *   The mutexs 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 *mutex) 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 mutexs
- *   The mutexs to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @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 mutexs) 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 mutexs
- *   The mutexs to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_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 mutexs) 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_)
-
-/**
- * Private implementation for resizing.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The new size to use.
- * @param onces
- *   The onces to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @see f_thread_onces_adjust()
- * @see f_thread_onces_decimate_by()
- */
-#if !defined(_di_f_thread_onces_adjust_) || !defined(_di_f_thread_onces_decimate_by_)
-  extern f_status_t private_f_thread_onces_adjust(const f_number_unsigned_t length, f_thread_onces_t * const onces) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_thread_onces_adjust_) || !defined(_di_f_thread_onces_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 onces
- *   The onces to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_resize()
- * @see f_thread_onces_decrease_by()
- * @see f_thread_onces_increase()
- * @see f_thread_onces_increase_by()
- */
-#if !defined(_di_f_thread_onces_decrease_by_) || !defined(_di_f_thread_onces_increase_) || !defined(_di_f_thread_onces_increase_by_)
-  extern f_status_t private_f_thread_onces_resize(const f_number_unsigned_t length, f_thread_onces_t * const onces) F_attribute_visibility_internal_d;
-#endif // !defined(_di_f_thread_onces_decrease_by_) || !defined(_di_f_thread_onces_increase_) || !defined(_di_f_thread_onces_increase_by_)
-
-/**
- * Private implementation for deleting (and destroying).
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param semaphore
- *   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 *semaphore) 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 semaphores
- *   The semaphores to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @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 semaphores) 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 semaphores
- *   The semaphores to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_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 semaphores) 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_)
-
-/**
- * Private implementation for resizing.
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param length
- *   The new size to use.
- * @param sets
- *   The sets to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @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 sets) 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 sets
- *   The sets to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_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 sets) 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_)
-
-/**
- * Private implementation for deleting (and destroying).
- *
- * Intended to be shared to each of the different implementation variations.
- *
- * @param spin
- *   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 *spin) 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 spins
- *   The spins to adjust.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_adjust().
- *
- * @see f_memory_adjust()
- * @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 spins) 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 spins
- *   The spins to resize.
- *
- * @return
- *   F_none on success.
- *
- *   Errors (with error bit) from: f_memory_resize().
- *
- * @see f_memory_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 spins) 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_h
index c57b6d9db904be65e8a33c11a0abe8244e842c7b..12eee62e59d27fe2283a9aba18c233689ae6f982 100644 (file)
@@ -1,5 +1,15 @@
 #include "thread.h"
-#include "private-thread.h"
+#include "thread/private-attribute.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" {
index c31f3677657e50b8cbf13f22cff3c8a3e3c5ecfd..19866d28144b16f920e7b4da795940cfc5b12be0 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-attribute.h"
 #include "attribute.h"
 
 #ifdef __cplusplus
@@ -24,11 +24,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (attributes->size > amount) {
-      return private_f_thread_attributes_adjust(attributes->size - amount, attributes);
-    }
-
-    return private_f_thread_attributes_adjust(0, attributes);
+    return private_f_thread_attributes_adjust((attributes->size > amount) ? attributes->size - amount : 0, attributes);
   }
 #endif // _di_f_thread_attributes_decimate_by_
 
@@ -40,11 +36,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (attributes->size > amount) {
-      return private_f_thread_attributes_resize(attributes->size - amount, attributes);
-    }
-
-    return private_f_thread_attributes_resize(0, attributes);
+    return private_f_thread_attributes_resize((attributes->size > amount) ? attributes->size - amount : 0, attributes);
   }
 #endif // _di_f_thread_attributes_decrease_by_
 
index cbae0f3f66c13257e719c78361396bfe87d2073a..e7a0a8026227e1129749b5dff0873f1d42aedc19 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-barrier.h"
 #include "barrier.h"
 
 #ifdef __cplusplus
index 467a8b99d7573418c99f0662fe32dfcf739df3ec..2e23288e2da67db507248d01fdf11d260d13ff5e 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-barrier_attribute.h"
 #include "barrier_attribute.h"
 
 #ifdef __cplusplus
index 3087bed2565da1b944de17a848261be0b712c080..523b63fb3857bd6811ebea00a487bdba19830155 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-condition.h"
 #include "condition.h"
 
 #ifdef __cplusplus
index 2e01272e54402ef344658d1fce4a242c00a3ebaf..740c503510673f7bc8befb31820e76823c16bb84 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-condition_attribute.h"
 #include "condition_attribute.h"
 
 #ifdef __cplusplus
index f998aabeedd8e5c1d73e799062f0e38b83d80a55..2bc8abd9378b162a1de49d7788f75bdf37c6933d 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-id.h"
 #include "id.h"
 
 #ifdef __cplusplus
index 841c8f2b63b66645c632e0ef756530459c81318c..f053118bc0f662372135f80bd74bd16adff5731e 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-key.h"
 #include "key.h"
 
 #ifdef __cplusplus
index d09388a21baba773b8e273847177f5df840ab879..fef1541e6278fcf27fb3a3ceefa2788594ddcf2c 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-lock.h"
 #include "lock.h"
 
 #ifdef __cplusplus
index 12e7aef2a1a85faf694ce8a3ad17e839831b0118..60ac6cd26c2f0b548a23e9c8e1d997ae4323dd81 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-lock_attribute.h"
 #include "lock_attribute.h"
 
 #ifdef __cplusplus
index 200310b5f17c5053b8ba8ae8ae239baa3d46ff39..8a290023405a9005eb6985daa7cd88c2480b7d30 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-mutex.h"
 #include "mutex.h"
 
 #ifdef __cplusplus
index 0c5e358997ae46dd46a10957b3f23353be2e4aec..ea3ee6012d927a68c81520a84909ea91ae6e9cae 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-mutex_attribute.h"
 #include "mutex_attribute.h"
 
 #ifdef __cplusplus
index 6373936b19b5b420c2c95bb16d80dde524d7c5ff..93e0e8e19373fe847a0fadf1871b68b26e6bd119 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-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
new file mode 100644 (file)
index 0000000..e2491f3
--- /dev/null
@@ -0,0 +1,51 @@
+#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 *attribute) {
+
+    if (pthread_attr_destroy(attribute)) return F_status_set_error(F_failure);
+
+    attribute = 0;
+
+    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
new file mode 100644 (file)
index 0000000..3926891
--- /dev/null
@@ -0,0 +1,341 @@
+/**
+ * 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 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_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 *attribute) 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_adjust().
+ *
+ * @see f_memory_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-barrier.c b/level_0/f_thread/c/thread/private-barrier.c
new file mode 100644 (file)
index 0000000..895804e
--- /dev/null
@@ -0,0 +1,58 @@
+#include "../thread.h"
+#include "private-barrier.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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_)
+  f_status_t private_f_thread_barrier_delete(f_thread_barrier_t *barrier) {
+
+    const int error = pthread_barrier_destroy(barrier);
+
+    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);
+    }
+
+    barrier = 0;
+
+    return F_none;
+  }
+#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_)
+
+#if !defined(_di_f_thread_barriers_adjust_) || !defined(_di_f_thread_barriers_decimate_by_)
+  f_status_t private_f_thread_barriers_adjust(const f_number_unsigned_t length, f_thread_barriers_t * const barriers) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < barriers->size; ++i) {
+
+      status = private_f_thread_barrier_delete(&barriers->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_barrier_t), (void **) &barriers->array, &barriers->used, &barriers->size);
+  }
+#endif // !defined(_di_f_thread_barriers_adjust_) || !defined(_di_f_thread_barriers_decimate_by_)
+
+#if !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_)
+  f_status_t private_f_thread_barriers_resize(const f_number_unsigned_t length, f_thread_barriers_t * const barriers) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < barriers->size; ++i) {
+
+      status = private_f_thread_barrier_delete(&barriers->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_barrier_t), (void **) &barriers->array, &barriers->used, &barriers->size);
+  }
+#endif // !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_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_thread/c/thread/private-barrier.h b/level_0/f_thread/c/thread/private-barrier.h
new file mode 100644 (file)
index 0000000..7a13de5
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ * 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_barrier_h
+#define _PRIVATE_F_thread_barrier_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 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_adjust().
+ *
+ * @see f_memory_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_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_F_thread_barrier_h
diff --git a/level_0/f_thread/c/thread/private-barrier_attribute.c b/level_0/f_thread/c/thread/private-barrier_attribute.c
new file mode 100644 (file)
index 0000000..2545b86
--- /dev/null
@@ -0,0 +1,51 @@
+#include "../thread.h"
+#include "private-barrier_attribute.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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_)
+  f_status_t private_f_thread_barrier_attribute_delete(f_thread_barrier_attribute_t *attribute) {
+
+    if (pthread_barrierattr_destroy(attribute)) return F_status_set_error(F_failure);
+
+    attribute = 0;
+
+    return F_none;
+  }
+#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_)
+
+#if !defined(_di_f_thread_barrier_attributes_adjust_) || !defined(_di_f_thread_barrier_attributes_decimate_by_)
+  f_status_t private_f_thread_barrier_attributes_adjust(const f_number_unsigned_t length, f_thread_barrier_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_barrier_attribute_delete(&attributes->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_barrier_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->size);
+  }
+#endif // !defined(_di_f_thread_barrier_attributes_adjust_) || !defined(_di_f_thread_barrier_attributes_decimate_by_)
+
+#if !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_)
+  f_status_t private_f_thread_barrier_attributes_resize(const f_number_unsigned_t length, f_thread_barrier_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_barrier_attribute_delete(&attributes->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_barrier_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->size);
+  }
+#endif // !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_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_thread/c/thread/private-barrier_attribute.h b/level_0/f_thread/c/thread/private-barrier_attribute.h
new file mode 100644 (file)
index 0000000..8ee63fd
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ * 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_barrier_attribute_h
+#define _PRIVATE_F_thread_barrier_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 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_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_F_thread_barrier_attribute_h
diff --git a/level_0/f_thread/c/thread/private-condition.c b/level_0/f_thread/c/thread/private-condition.c
new file mode 100644 (file)
index 0000000..24d45e6
--- /dev/null
@@ -0,0 +1,56 @@
+#include "../thread.h"
+#include "private-condition.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_di_f_thread_condition_delete_) || !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_) || !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_) || !defined(_di_f_thread_conditions_resize_)
+  f_status_t private_f_thread_condition_delete(f_thread_condition_t *condition) {
+
+    const int error = pthread_cond_destroy(condition);
+
+    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_condition_delete_) || !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_) || !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_) || !defined(_di_f_thread_conditions_resize_)
+
+#if !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_)
+  f_status_t private_f_thread_conditions_adjust(const f_number_unsigned_t length, f_thread_conditions_t * const conditions) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < conditions->size; ++i) {
+
+      status = private_f_thread_condition_delete(&conditions->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_condition_t), (void **) &conditions->array, &conditions->used, &conditions->size);
+  }
+#endif // !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_)
+
+#if !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_)
+  f_status_t private_f_thread_conditions_resize(const f_number_unsigned_t length, f_thread_conditions_t * const conditions) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < conditions->size; ++i) {
+
+      status = private_f_thread_condition_delete(&conditions->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_condition_t), (void **) &conditions->array, &conditions->used, &conditions->size);
+  }
+#endif // !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_thread/c/thread/private-condition.h b/level_0/f_thread/c/thread/private-condition.h
new file mode 100644 (file)
index 0000000..0441ba8
--- /dev/null
@@ -0,0 +1,101 @@
+/**
+ * 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_condition_h
+#define _PRIVATE_F_thread_condition_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 conditions
+ *   The conditions 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_cond_destroy()
+ *
+ * @see f_thread_condition_delete()
+ * @see f_thread_conditions_adjust()
+ * @see f_thread_conditions_decimate_by()
+ * @see f_thread_conditions_decrease()
+ * @see f_thread_conditions_decrease_by()
+ * @see f_thread_conditions_increase()
+ * @see f_thread_conditions_increase_by()
+ * @see f_thread_conditions_resize()
+ */
+#if !defined(_di_f_thread_condition_delete_) || !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_) || !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_) || !defined(_di_f_thread_conditions_resize_)
+  extern f_status_t private_f_thread_condition_delete(f_thread_condition_t *condition) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_thread_condition_delete_) || !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_) || !defined(_di_f_thread_conditions_decrease_) || !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_) || !defined(_di_f_thread_conditions_resize_)
+
+/**
+ * Private implementation for resizing.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param length
+ *   The new size to use.
+ * @param conditions
+ *   The conditions to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @see f_thread_conditions_adjust()
+ * @see f_thread_conditions_decimate_by()
+ */
+#if !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_decimate_by_)
+  extern f_status_t private_f_thread_conditions_adjust(const f_number_unsigned_t length, f_thread_conditions_t * const conditions) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_thread_conditions_adjust_) || !defined(_di_f_thread_conditions_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 conditions
+ *   The conditions to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ * @see f_thread_conditions_decrease_by()
+ * @see f_thread_conditions_increase()
+ * @see f_thread_conditions_increase_by()
+ */
+#if !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_)
+  extern f_status_t private_f_thread_conditions_resize(const f_number_unsigned_t length, f_thread_conditions_t * const conditions) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_thread_conditions_decrease_by_) || !defined(_di_f_thread_conditions_increase_) || !defined(_di_f_thread_conditions_increase_by_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_F_thread_condition_h
diff --git a/level_0/f_thread/c/thread/private-condition_attribute.c b/level_0/f_thread/c/thread/private-condition_attribute.c
new file mode 100644 (file)
index 0000000..218411a
--- /dev/null
@@ -0,0 +1,56 @@
+#include "../thread.h"
+#include "private-condition_attribute.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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_)
+  f_status_t private_f_thread_condition_attribute_delete(f_thread_condition_attribute_t * const attribute) {
+
+    const int error = pthread_condattr_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 // !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_)
+
+#if !defined(_di_f_thread_condition_attributes_adjust_) || !defined(_di_f_thread_condition_attributes_decimate_by_)
+  f_status_t private_f_thread_condition_attributes_adjust(const f_number_unsigned_t length, f_thread_condition_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_condition_attribute_delete(&attributes->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_condition_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->size);
+  }
+#endif // !defined(_di_f_thread_condition_attributes_adjust_) || !defined(_di_f_thread_condition_attributes_decimate_by_)
+
+#if !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_)
+  f_status_t private_f_thread_condition_attributes_resize(const f_number_unsigned_t length, f_thread_condition_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_condition_attribute_delete(&attributes->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_condition_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->size);
+  }
+#endif // !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_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_thread/c/thread/private-condition_attribute.h b/level_0/f_thread/c/thread/private-condition_attribute.h
new file mode 100644 (file)
index 0000000..fdefb9b
--- /dev/null
@@ -0,0 +1,100 @@
+/**
+ * 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_condition_attribute_h
+#define _PRIVATE_F_thread_condition_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 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_condition_attribute_h
diff --git a/level_0/f_thread/c/thread/private-id.c b/level_0/f_thread/c/thread/private-id.c
new file mode 100644 (file)
index 0000000..3a37e91
--- /dev/null
@@ -0,0 +1,28 @@
+#include "../thread.h"
+#include "private-id.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_di_f_thread_ids_adjust_) || !defined(_di_f_thread_ids_decimate_by_)
+  f_status_t private_f_thread_ids_adjust(const f_number_unsigned_t length, f_thread_ids_t * const ids) {
+
+    if (ids->size) {
+      memset(ids->array, 0, sizeof(f_thread_id_t) * ids->size);
+    }
+
+    return f_memory_array_adjust(length, sizeof(f_thread_id_t), (void **) &ids->array, &ids->used, &ids->size);
+  }
+#endif // !defined(_di_f_thread_ids_adjust_) || !defined(_di_f_thread_ids_decimate_by_)
+
+#if !defined(_di_f_thread_ids_decrease_) || !defined(_di_f_thread_ids_decrease_by_) || !defined(_di_f_thread_ids_increase_) || !defined(_di_f_thread_ids_increase_by_)
+  f_status_t private_f_thread_ids_resize(const f_number_unsigned_t length, f_thread_ids_t * const ids) {
+
+    return f_memory_array_resize(length, sizeof(f_thread_id_t), (void **) &ids->array, &ids->used, &ids->size);
+  }
+#endif // !defined(_di_f_thread_ids_decrease_) || !defined(_di_f_thread_ids_decrease_by_) || !defined(_di_f_thread_ids_increase_) || !defined(_di_f_thread_ids_increase_by_)
+
+#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
new file mode 100644 (file)
index 0000000..5bd9a38
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * 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
+
+/**
+ * Private implementation for resizing.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param length
+ *   The new size to use.
+ * @param ids
+ *   The ids to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @see f_thread_ids_adjust()
+ * @see f_thread_ids_decimate_by()
+ */
+#if !defined(_di_f_thread_ids_adjust_) || !defined(_di_f_thread_ids_decimate_by_)
+  extern f_status_t private_f_thread_ids_adjust(const f_number_unsigned_t length, f_thread_ids_t * const ids) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_thread_ids_adjust_) || !defined(_di_f_thread_ids_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 ids
+ *   The ids to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ * @see f_thread_ids_decrease_by()
+ * @see f_thread_ids_increase()
+ * @see f_thread_ids_increase_by()
+ */
+#if !defined(_di_f_thread_ids_decrease_by_) || !defined(_di_f_thread_ids_increase_) || !defined(_di_f_thread_ids_increase_by_)
+  extern f_status_t private_f_thread_ids_resize(const f_number_unsigned_t length, f_thread_ids_t * const ids) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_thread_ids_decrease_by_) || !defined(_di_f_thread_ids_increase_) || !defined(_di_f_thread_ids_increase_by_)
+
+#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
new file mode 100644 (file)
index 0000000..df4feaa
--- /dev/null
@@ -0,0 +1,51 @@
+#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 *key) {
+
+    if (pthread_key_delete(*key)) return F_status_set_error(F_failure);
+
+    *key = 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 keys) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < keys->size; ++i) {
+
+      status = private_f_thread_key_delete(&keys->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_key_t), (void **) &keys->array, &keys->used, &keys->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 keys) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < keys->size; ++i) {
+
+      status = private_f_thread_key_delete(&keys->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_key_t), (void **) &keys->array, &keys->used, &keys->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
new file mode 100644 (file)
index 0000000..0595175
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * 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 key
+ *   The keys 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 *key) 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 keys
+ *   The keys to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @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 keys) 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 keys
+ *   The keys to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_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 keys) 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
new file mode 100644 (file)
index 0000000..96293c8
--- /dev/null
@@ -0,0 +1,56 @@
+#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 *lock) {
+
+    const 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 // !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 locks) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < locks->size; ++i) {
+
+      status = private_f_thread_lock_delete(&locks->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_lock_t), (void **) &locks->array, &locks->used, &locks->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 locks) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < locks->size; ++i) {
+
+      status = private_f_thread_lock_delete(&locks->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_lock_t), (void **) &locks->array, &locks->used, &locks->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
new file mode 100644 (file)
index 0000000..7532111
--- /dev/null
@@ -0,0 +1,99 @@
+/**
+ * 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 lock
+ *   The locks 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 *lock) 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 locks
+ *   The locks to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @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 locks) 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 locks
+ *   The locks to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_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 locks) 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
new file mode 100644 (file)
index 0000000..42d3ed2
--- /dev/null
@@ -0,0 +1,56 @@
+#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 *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 // !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 attributes) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < attributes->size; ++i) {
+
+      status = private_f_thread_lock_attribute_delete(&attributes->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_lock_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->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 attributes) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < attributes->size; ++i) {
+
+      status = private_f_thread_lock_attribute_delete(&attributes->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_lock_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->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
new file mode 100644 (file)
index 0000000..e0f8cd3
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * 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 attribute
+ *   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 *attribute) 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 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_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 attributes) 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 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_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 attributes) 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
new file mode 100644 (file)
index 0000000..3beab4c
--- /dev/null
@@ -0,0 +1,56 @@
+#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 *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 // !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 mutexs) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < mutexs->size; ++i) {
+
+      status = private_f_thread_mutex_delete(&mutexs->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_mutex_t), (void **) &mutexs->array, &mutexs->used, &mutexs->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 mutexs) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < mutexs->size; ++i) {
+
+      status = private_f_thread_mutex_delete(&mutexs->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_mutex_t), (void **) &mutexs->array, &mutexs->used, &mutexs->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
new file mode 100644 (file)
index 0000000..f0a2a05
--- /dev/null
@@ -0,0 +1,99 @@
+/**
+ * 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 mutex
+ *   The mutexs 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 *mutex) 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 mutexs
+ *   The mutexs to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @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 mutexs) 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 mutexs
+ *   The mutexs to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_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 mutexs) 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
new file mode 100644 (file)
index 0000000..9b7c448
--- /dev/null
@@ -0,0 +1,56 @@
+#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 *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 // !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 attributes) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < attributes->size; ++i) {
+
+      status = private_f_thread_mutex_attribute_delete(&attributes->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_mutex_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->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 attributes) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < attributes->size; ++i) {
+
+      status = private_f_thread_mutex_attribute_delete(&attributes->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_mutex_attribute_t), (void **) &attributes->array, &attributes->used, &attributes->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
new file mode 100644 (file)
index 0000000..74e90b5
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * 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 attribute
+ *   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 *attribute) 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 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_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 attributes) 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 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_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 attributes) 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-once.c b/level_0/f_thread/c/thread/private-once.c
new file mode 100644 (file)
index 0000000..80aaa24
--- /dev/null
@@ -0,0 +1,28 @@
+#include "../thread.h"
+#include "private-once.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_di_f_thread_onces_adjust_) || !defined(_di_f_thread_onces_decimate_by_)
+  f_status_t private_f_thread_onces_adjust(const f_number_unsigned_t length, f_thread_onces_t * const onces) {
+
+    if (onces->size) {
+      memset(onces->array, 0, sizeof(f_thread_once_t) * onces->size);
+    }
+
+    return f_memory_array_adjust(length, sizeof(f_thread_once_t), (void **) &onces->array, &onces->used, &onces->size);
+  }
+#endif // !defined(_di_f_thread_onces_adjust_) || !defined(_di_f_thread_onces_decimate_by_)
+
+#if !defined(_di_f_thread_onces_decrease_) || !defined(_di_f_thread_onces_decrease_by_) || !defined(_di_f_thread_onces_increase_) || !defined(_di_f_thread_onces_increase_by_)
+  f_status_t private_f_thread_onces_resize(const f_number_unsigned_t length, f_thread_onces_t * const onces) {
+
+    return f_memory_array_resize(length, sizeof(f_thread_once_t), (void **) &onces->array, &onces->used, &onces->size);
+  }
+#endif // !defined(_di_f_thread_onces_decrease_) || !defined(_di_f_thread_onces_decrease_by_) || !defined(_di_f_thread_onces_increase_) || !defined(_di_f_thread_onces_increase_by_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_0/f_thread/c/thread/private-once.h b/level_0/f_thread/c/thread/private-once.h
new file mode 100644 (file)
index 0000000..ecc8bd3
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * 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_once_h
+#define _PRIVATE_F_thread_once_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 onces
+ *   The onces to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @see f_thread_onces_adjust()
+ * @see f_thread_onces_decimate_by()
+ */
+#if !defined(_di_f_thread_onces_adjust_) || !defined(_di_f_thread_onces_decimate_by_)
+  extern f_status_t private_f_thread_onces_adjust(const f_number_unsigned_t length, f_thread_onces_t * const onces) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_thread_onces_adjust_) || !defined(_di_f_thread_onces_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 onces
+ *   The onces to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ * @see f_thread_onces_decrease_by()
+ * @see f_thread_onces_increase()
+ * @see f_thread_onces_increase_by()
+ */
+#if !defined(_di_f_thread_onces_decrease_by_) || !defined(_di_f_thread_onces_increase_) || !defined(_di_f_thread_onces_increase_by_)
+  extern f_status_t private_f_thread_onces_resize(const f_number_unsigned_t length, f_thread_onces_t * const onces) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_thread_onces_decrease_by_) || !defined(_di_f_thread_onces_increase_) || !defined(_di_f_thread_onces_increase_by_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_F_thread_once_h
diff --git a/level_0/f_thread/c/thread/private-semaphore.c b/level_0/f_thread/c/thread/private-semaphore.c
new file mode 100644 (file)
index 0000000..c69bda7
--- /dev/null
@@ -0,0 +1,55 @@
+#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 *semaphore) {
+
+    const int result = sem_destroy(semaphore);
+
+    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 semaphores) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < semaphores->size; ++i) {
+
+      status = private_f_thread_semaphore_delete(&semaphores->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_semaphore_t), (void **) &semaphores->array, &semaphores->used, &semaphores->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 semaphores) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < semaphores->size; ++i) {
+
+      status = private_f_thread_semaphore_delete(&semaphores->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_semaphore_t), (void **) &semaphores->array, &semaphores->used, &semaphores->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
new file mode 100644 (file)
index 0000000..abe7f48
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * 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 semaphore
+ *   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 *semaphore) 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 semaphores
+ *   The semaphores to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @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 semaphores) 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 semaphores
+ *   The semaphores to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_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 semaphores) 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
new file mode 100644 (file)
index 0000000..30e15f7
--- /dev/null
@@ -0,0 +1,41 @@
+#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 sets) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < sets->size; ++i) {
+
+      status = private_f_thread_attribute_delete(&sets->array[i].attribute);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_set_t), (void **) &sets->array, &sets->used, &sets->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 sets) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < sets->size; ++i) {
+
+      status = private_f_thread_attribute_delete(&sets->array[i].attribute);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_set_t), (void **) &sets->array, &sets->used, &sets->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
new file mode 100644 (file)
index 0000000..ab8eb20
--- /dev/null
@@ -0,0 +1,69 @@
+/**
+ * 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 sets
+ *   The sets to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @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 sets) 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 sets
+ *   The sets to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_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 sets) 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
new file mode 100644 (file)
index 0000000..d5de418
--- /dev/null
@@ -0,0 +1,56 @@
+#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 *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 // !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 spins) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < spins->size; ++i) {
+
+      status = private_f_thread_spin_delete(&spins->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_adjust(length, sizeof(f_thread_spin_t), (void **) &spins->array, &spins->used, &spins->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 spins) {
+
+    f_status_t status = F_none;
+
+    for (f_number_unsigned_t i = length; i < spins->size; ++i) {
+
+      status = private_f_thread_spin_delete(&spins->array[i]);
+      if (F_status_is_error(status)) return status;
+    } // for
+
+    return f_memory_array_resize(length, sizeof(f_thread_spin_t), (void **) &spins->array, &spins->used, &spins->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
new file mode 100644 (file)
index 0000000..a49ac72
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * 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 spin
+ *   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 *spin) 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 spins
+ *   The spins to adjust.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_adjust().
+ *
+ * @see f_memory_adjust()
+ * @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 spins) 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 spins
+ *   The spins to resize.
+ *
+ * @return
+ *   F_none on success.
+ *
+ *   Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_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 spins) 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
index 85ea6971aa5571dd391048b0940cc981e59cf830..9eb802e1f93c4de23e67fded60401c04c89998cf 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-semaphore.h"
 #include "semaphore.h"
 
 #ifdef __cplusplus
@@ -24,11 +24,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (semaphores->size > amount) {
-      return private_f_thread_semaphores_adjust(semaphores->size - amount, semaphores);
-    }
-
-    return private_f_thread_semaphores_adjust(0, semaphores);
+    return private_f_thread_semaphores_adjust((semaphores->size > amount) ? semaphores->size - amount : 0, semaphores);
   }
 #endif // _di_f_thread_semaphores_decimate_by_
 
@@ -40,11 +36,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (semaphores->size > amount) {
-      return private_f_thread_semaphores_resize(semaphores->size - amount, semaphores);
-    }
-
-    return private_f_thread_semaphores_resize(0, semaphores);
+    return private_f_thread_semaphores_resize((semaphores->size > amount) ? semaphores->size - amount : 0, semaphores);
   }
 #endif // _di_f_thread_semaphores_decrease_by_
 
@@ -58,9 +50,7 @@ extern "C" {
       f_number_unsigned_t size = semaphores->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (semaphores->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (semaphores->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index a0e55a9d86bcd0bb8d2e0ced3d669554aca19bad..d2fd766b6038b2fa5f419e7c5436f36fbbb37cfb 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-set.h"
 #include "set.h"
 
 #ifdef __cplusplus
@@ -24,11 +24,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (sets->size > amount) {
-      return private_f_thread_sets_adjust(sets->size - amount, sets);
-    }
-
-    return private_f_thread_sets_adjust(0, sets);
+    return private_f_thread_sets_adjust((sets->size > amount) ? sets->size - amount : 0, sets);
   }
 #endif // _di_f_thread_sets_decimate_by_
 
@@ -40,11 +36,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (sets->size > amount) {
-      return private_f_thread_sets_resize(sets->size - amount, sets);
-    }
-
-    return private_f_thread_sets_resize(0, sets);
+    return private_f_thread_sets_resize((sets->size > amount) ? sets->size - amount : 0, sets);
   }
 #endif // _di_f_thread_sets_decrease_by_
 
@@ -58,9 +50,7 @@ extern "C" {
       f_number_unsigned_t size = sets->used + step;
 
       if (size > F_number_t_size_unsigned_d) {
-        if (sets->used + 1 > F_number_t_size_unsigned_d) {
-          return F_status_set_error(F_array_too_large);
-        }
+        if (sets->used + 1 > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large);
 
         size = F_number_t_size_unsigned_d;
       }
index 81258cf5daabb1bb61c7776faf3dc6fcef9c30d1..a74a2f5363982b8ebf059fcaa3985a4ed4b610c1 100644 (file)
@@ -1,5 +1,5 @@
 #include "../thread.h"
-#include "../private-thread.h"
+#include "private-spin.h"
 #include "spin.h"
 
 #ifdef __cplusplus
@@ -24,11 +24,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (spins->size > amount) {
-      return private_f_thread_spins_adjust(spins->size - amount, spins);
-    }
-
-    return private_f_thread_spins_adjust(0, spins);
+    return private_f_thread_spins_adjust((spins->size > amount) ? spins->size - amount : 0, spins);
   }
 #endif // _di_f_thread_spins_decimate_by_
 
@@ -40,11 +36,7 @@ extern "C" {
 
     if (!amount) return F_data_not;
 
-    if (spins->size > amount) {
-      return private_f_thread_spins_resize(spins->size - amount, spins);
-    }
-
-    return private_f_thread_spins_resize(0, spins);
+    return private_f_thread_spins_resize((spins->size > amount) ? spins->size - amount : 0, spins);
   }
 #endif // _di_f_thread_spins_decrease_by_
 
index 7a58ba08ffec8c58c275de9e2fe239f94ef90772..efe26df9d3516ea25145d4347b37b614a31024b7 100644 (file)
@@ -34,7 +34,8 @@ build_language c
 build_libraries -lc
 build_libraries-individual -lf_memory -lf_string
 
-build_sources_library thread.c private-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.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_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
 
index b1556761a5c4f8a5a4a9c82474c316bc1658beb0..11105da0b3b19d0b515253ac4cd23482171256ef 100644 (file)
@@ -30,7 +30,8 @@ build_language c
 build_libraries -pthread -lc
 build_libraries-individual -lf_memory -lf_string
 
-build_sources_library thread.c private-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.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_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