From 56ec14d42fe7fbf8c3b696d4a33bee722337fdf2 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sun, 3 Jan 2021 21:34:18 -0600 Subject: [PATCH] Cleanup: use the structure macros for memory operations. How silly of me. I have these structure macros and I am not even using them in this class. Fix the f_thread project to use these structure macros. --- level_0/f_thread/c/thread-common.h | 559 +++++++------------------------------ 1 file changed, 108 insertions(+), 451 deletions(-) diff --git a/level_0/f_thread/c/thread-common.h b/level_0/f_thread/c/thread-common.h index 76aad67..21be3e9 100644 --- a/level_0/f_thread/c/thread-common.h +++ b/level_0/f_thread/c/thread-common.h @@ -45,56 +45,18 @@ extern "C" { #define f_thread_attributes_t_initialize { 0, 0, 0 } - #define f_macro_thread_attributes_t_clear(attributes) \ - attributes.array = 0; \ - attributes.size = 0; \ - attributes.used = 0; - - #define f_macro_thread_attributes_new(status, attributes, length) \ - f_macro_thread_attributes_t_clear(attributes) \ - status = f_memory_new((void **) & attributes.array, sizeof(f_thread_attribute_t), length); \ - if (status == F_none) { \ - attributes.size = length; \ - attributes.used = 0; \ - } - - #define f_macro_thread_attributes_t_delete(status, attributes) \ - status = f_memory_delete((void **) & attributes.array, sizeof(f_thread_attribute_t), attributes.size); \ - if (status == F_none) { \ - attributes.used = 0; \ - attributes.size = 0; \ - } - - #define f_macro_thread_attributes_t_destroy(status, attributes) \ - status = f_memory_destroy((void **) & attributes.array, sizeof(f_thread_attribute_t), attributes.size); \ - if (status == F_none) { \ - attributes.used = 0; \ - attributes.size = 0; \ - } - - #define f_macro_thread_attributes_t_delete_simple(attributes) \ - f_memory_delete((void **) & attributes.array, sizeof(f_thread_attribute_t), attributes.size); \ - attributes.used = 0; \ - attributes.size = 0; - - #define f_macro_thread_attributes_t_destroy_simple(attributes) \ - f_memory_destroy((void **) & attributes.array, sizeof(f_thread_attribute_t), attributes.size); \ - attributes.used = 0; \ - attributes.size = 0; - - #define f_macro_thread_attributes_t_resize(status, attributes, new_length) \ - status = f_memory_resize((void **) & attributes.array, sizeof(f_thread_attribute_t), attributes.size, new_length); \ - if (status == F_none) { \ - attributes.size = new_length; \ - if (attributes.used > attributes.size) attributes.used = new_length; \ - } - - #define f_macro_thread_attributes_t_adjust(status, attributes, new_length) \ - status = f_memory_adjust((void **) & attributes.array, sizeof(f_thread_attribute_t), attributes.size, new_length); \ - if (status == F_none) { \ - attributes.size = new_length; \ - if (attributes.used > attributes.size) attributes.used = new_length; \ - } + #define f_macro_thread_attributes_t_clear(attributes) f_macro_memory_structure_t_clear(attributes) + + #define f_macro_thread_attributes_t_new(status, attributes, length) f_macro_memory_structure_t_new(status, attributes, f_thread_attribute_t, length) + + #define f_macro_thread_attributes_t_delete(status, attributes) f_macro_memory_structure_t_delete(status, attributes, f_thread_attribute_t) + #define f_macro_thread_attributes_t_destroy(status, attributes) f_macro_memory_structure_t_destroy(status, attributes, f_thread_attribute_t) + + #define f_macro_thread_attributes_t_delete_simple(attributes) f_macro_memory_structure_t_delete_simple(attributes, f_thread_attribute_t) + #define f_macro_thread_attributes_t_destroy_simple(attributes) f_macro_memory_structure_t_destroy_simple(attributes, f_thread_attribute_t) + + #define f_macro_thread_attributes_t_resize(status, attributes, new_length) f_macro_memory_structure_t_resize(status, attributes, f_thread_attribute_t, new_length) + #define f_macro_thread_attributes_t_adjust(status, attributes, new_length) f_macro_memory_structure_t_adjust(status, attributes, f_thread_attribute_t, new_length) #endif // _di_f_thread_attributes_t_ /** @@ -125,56 +87,18 @@ extern "C" { #define f_thread_conditions_t_initialize { 0, 0, 0 } - #define f_macro_thread_conditions_t_clear(conditions) \ - conditions.array = 0; \ - conditions.size = 0; \ - conditions.used = 0; - - #define f_macro_thread_conditions_new(status, conditions, length) \ - f_macro_thread_conditions_t_clear(conditions) \ - status = f_memory_new((void **) & conditions.array, sizeof(f_thread_condition_t), length); \ - if (status == F_none) { \ - conditions.size = length; \ - conditions.used = 0; \ - } - - #define f_macro_thread_conditions_t_delete(status, conditions) \ - status = f_memory_delete((void **) & conditions.array, sizeof(f_thread_condition_t), conditions.size); \ - if (status == F_none) { \ - conditions.used = 0; \ - conditions.size = 0; \ - } - - #define f_macro_thread_conditions_t_destroy(status, conditions) \ - status = f_memory_destroy((void **) & conditions.array, sizeof(f_thread_condition_t), conditions.size); \ - if (status == F_none) { \ - conditions.used = 0; \ - conditions.size = 0; \ - } - - #define f_macro_thread_conditions_t_delete_simple(conditions) \ - f_memory_delete((void **) & conditions.array, sizeof(f_thread_condition_t), conditions.size); \ - conditions.used = 0; \ - conditions.size = 0; - - #define f_macro_thread_conditions_t_destroy_simple(conditions) \ - f_memory_destroy((void **) & conditions.array, sizeof(f_thread_condition_t), conditions.size); \ - conditions.used = 0; \ - conditions.size = 0; - - #define f_macro_thread_conditions_t_resize(status, conditions, new_length) \ - status = f_memory_resize((void **) & conditions.array, sizeof(f_thread_condition_t), conditions.size, new_length); \ - if (status == F_none) { \ - conditions.size = new_length; \ - if (conditions.used > conditions.size) conditions.used = new_length; \ - } - - #define f_macro_thread_conditions_t_adjust(status, conditions, new_length) \ - status = f_memory_adjust((void **) & conditions.array, sizeof(f_thread_condition_t), conditions.size, new_length); \ - if (status == F_none) { \ - conditions.size = new_length; \ - if (conditions.used > conditions.size) conditions.used = new_length; \ - } + #define f_macro_thread_conditions_t_clear(conditions) f_macro_memory_structure_t_clear(conditions) + + #define f_macro_thread_conditions_t_new(status, conditions, length) f_macro_memory_structure_t_new(status, conditions, f_thread_condition_t, length) + + #define f_macro_thread_conditions_t_delete(status, conditions) f_macro_memory_structure_t_delete(status, conditions, f_thread_condition_t) + #define f_macro_thread_conditions_t_destroy(status, conditions) f_macro_memory_structure_t_destroy(status, conditions, f_thread_condition_t) + + #define f_macro_thread_conditions_t_delete_simple(conditions) f_macro_memory_structure_t_delete_simple(conditions, f_thread_condition_t) + #define f_macro_thread_conditions_t_destroy_simple(conditions) f_macro_memory_structure_t_destroy_simple(conditions, f_thread_condition_t) + + #define f_macro_thread_conditions_t_resize(status, conditions, new_length) f_macro_memory_structure_t_resize(status, conditions, f_thread_condition_t, new_length) + #define f_macro_thread_conditions_t_adjust(status, conditions, new_length) f_macro_memory_structure_t_adjust(status, conditions, f_thread_condition_t, new_length) #endif // _di_f_thread_conditions_t_ /** @@ -205,56 +129,18 @@ extern "C" { #define f_thread_ids_t_initialize { 0, 0, 0 } - #define f_macro_thread_ids_t_clear(ids) \ - ids.array = 0; \ - ids.size = 0; \ - ids.used = 0; - - #define f_macro_thread_ids_new(status, ids, length) \ - f_macro_thread_ids_t_clear(ids) \ - status = f_memory_new((void **) & ids.array, sizeof(f_thread_id_t), length); \ - if (status == F_none) { \ - ids.size = length; \ - ids.used = 0; \ - } - - #define f_macro_thread_ids_t_delete(status, ids) \ - status = f_memory_delete((void **) & ids.array, sizeof(f_thread_id_t), ids.size); \ - if (status == F_none) { \ - ids.used = 0; \ - ids.size = 0; \ - } - - #define f_macro_thread_ids_t_destroy(status, ids) \ - status = f_memory_destroy((void **) & ids.array, sizeof(f_thread_id_t), ids.size); \ - if (status == F_none) { \ - ids.used = 0; \ - ids.size = 0; \ - } - - #define f_macro_thread_ids_t_delete_simple(ids) \ - f_memory_delete((void **) & ids.array, sizeof(f_thread_id_t), ids.size); \ - ids.used = 0; \ - ids.size = 0; - - #define f_macro_thread_ids_t_destroy_simple(ids) \ - f_memory_destroy((void **) & ids.array, sizeof(f_thread_id_t), ids.size); \ - ids.used = 0; \ - ids.size = 0; - - #define f_macro_thread_ids_t_resize(status, ids, new_length) \ - status = f_memory_resize((void **) & ids.array, sizeof(f_thread_id_t), ids.size, new_length); \ - if (status == F_none) { \ - ids.size = new_length; \ - if (ids.used > ids.size) ids.used = new_length; \ - } - - #define f_macro_thread_ids_t_adjust(status, ids, new_length) \ - status = f_memory_adjust((void **) & ids.array, sizeof(f_thread_id_t), ids.size, new_length); \ - if (status == F_none) { \ - ids.size = new_length; \ - if (ids.used > ids.size) ids.used = new_length; \ - } + #define f_macro_thread_ids_t_clear(ids) f_macro_memory_structure_t_clear(ids) + + #define f_macro_thread_ids_t_new(status, ids, length) f_macro_memory_structure_t_new(status, ids, f_thread_ids_t, length) + + #define f_macro_thread_ids_t_delete(status, ids) f_macro_memory_structure_t_delete(status, ids, f_thread_ids_t) + #define f_macro_thread_ids_t_destroy(status, ids) f_macro_memory_structure_t_destroy(status, ids, f_thread_ids_t) + + #define f_macro_thread_ids_t_delete_simple(ids) f_macro_memory_structure_t_delete_simple(ids, f_thread_ids_t) + #define f_macro_thread_ids_t_destroy_simple(ids) f_macro_memory_structure_t_destroy_simple(ids, f_thread_ids_t) + + #define f_macro_thread_ids_t_resize(status, ids, new_length) f_macro_memory_structure_t_resize(status, ids, f_thread_ids_t, new_length) + #define f_macro_thread_ids_t_adjust(status, ids, new_length) f_macro_memory_structure_t_adjust(status, ids, f_thread_ids_t, new_length) #endif // _di_f_thread_ids_t_ /** @@ -285,56 +171,18 @@ extern "C" { #define f_thread_keys_t_initialize { 0, 0, 0 } - #define f_macro_thread_keys_t_clear(keys) \ - keys.array = 0; \ - keys.size = 0; \ - keys.used = 0; - - #define f_macro_thread_keys_new(status, keys, length) \ - f_macro_thread_keys_t_clear(keys) \ - status = f_memory_new((void **) & keys.array, sizeof(f_thread_key_t), length); \ - if (status == F_none) { \ - keys.size = length; \ - keys.used = 0; \ - } - - #define f_macro_thread_keys_t_delete(status, keys) \ - status = f_memory_delete((void **) & keys.array, sizeof(f_thread_key_t), keys.size); \ - if (status == F_none) { \ - keys.used = 0; \ - keys.size = 0; \ - } - - #define f_macro_thread_keys_t_destroy(status, keys) \ - status = f_memory_destroy((void **) & keys.array, sizeof(f_thread_key_t), keys.size); \ - if (status == F_none) { \ - keys.used = 0; \ - keys.size = 0; \ - } - - #define f_macro_thread_keys_t_delete_simple(keys) \ - f_memory_delete((void **) & keys.array, sizeof(f_thread_key_t), keys.size); \ - keys.used = 0; \ - keys.size = 0; - - #define f_macro_thread_keys_t_destroy_simple(keys) \ - f_memory_destroy((void **) & keys.array, sizeof(f_thread_key_t), keys.size); \ - keys.used = 0; \ - keys.size = 0; - - #define f_macro_thread_keys_t_resize(status, keys, new_length) \ - status = f_memory_resize((void **) & keys.array, sizeof(f_thread_key_t), keys.size, new_length); \ - if (status == F_none) { \ - keys.size = new_length; \ - if (keys.used > keys.size) keys.used = new_length; \ - } - - #define f_macro_thread_keys_t_adjust(status, keys, new_length) \ - status = f_memory_adjust((void **) & keys.array, sizeof(f_thread_key_t), keys.size, new_length); \ - if (status == F_none) { \ - keys.size = new_length; \ - if (keys.used > keys.size) keys.used = new_length; \ - } + #define f_macro_thread_keys_t_clear(keys) f_macro_memory_structure_t_clear(keys) + + #define f_macro_thread_keys_t_new(status, keys, length) f_macro_memory_structure_t_new(status, keys, f_thread_key_t, length) + + #define f_macro_thread_keys_t_delete(status, keys) f_macro_memory_structure_t_delete(status, keys, f_thread_key_t) + #define f_macro_thread_keys_t_destroy(status, keys) f_macro_memory_structure_t_destroy(status, keys, f_thread_key_t) + + #define f_macro_thread_keys_t_delete_simple(keys) f_macro_memory_structure_t_delete_simple(keys, f_thread_key_t) + #define f_macro_thread_keys_t_destroy_simple(keys) f_macro_memory_structure_t_destroy_simple(keys, f_thread_key_t) + + #define f_macro_thread_keys_t_resize(status, keys, new_length) f_macro_memory_structure_t_resize(status, keys, f_thread_key_t, new_length) + #define f_macro_thread_keys_t_adjust(status, keys, new_length) f_macro_memory_structure_t_adjust(status, keys, f_thread_key_t, new_length) #endif // _di_f_thread_keys_t_ /** @@ -365,56 +213,18 @@ extern "C" { #define f_thread_locks_t_initialize { 0, 0, 0 } - #define f_macro_thread_locks_t_clear(locks) \ - locks.array = 0; \ - locks.size = 0; \ - locks.used = 0; - - #define f_macro_thread_locks_new(status, locks, length) \ - f_macro_thread_locks_t_clear(locks) \ - status = f_memory_new((void **) & locks.array, sizeof(f_thread_lock_t), length); \ - if (status == F_none) { \ - locks.size = length; \ - locks.used = 0; \ - } - - #define f_macro_thread_locks_t_delete(status, locks) \ - status = f_memory_delete((void **) & locks.array, sizeof(f_thread_lock_t), locks.size); \ - if (status == F_none) { \ - locks.used = 0; \ - locks.size = 0; \ - } - - #define f_macro_thread_locks_t_destroy(status, locks) \ - status = f_memory_destroy((void **) & locks.array, sizeof(f_thread_lock_t), locks.size); \ - if (status == F_none) { \ - locks.used = 0; \ - locks.size = 0; \ - } - - #define f_macro_thread_locks_t_delete_simple(locks) \ - f_memory_delete((void **) & locks.array, sizeof(f_thread_lock_t), locks.size); \ - locks.used = 0; \ - locks.size = 0; - - #define f_macro_thread_locks_t_destroy_simple(locks) \ - f_memory_destroy((void **) & locks.array, sizeof(f_thread_lock_t), locks.size); \ - locks.used = 0; \ - locks.size = 0; - - #define f_macro_thread_locks_t_resize(status, locks, new_length) \ - status = f_memory_resize((void **) & locks.array, sizeof(f_thread_lock_t), locks.size, new_length); \ - if (status == F_none) { \ - locks.size = new_length; \ - if (locks.used > locks.size) locks.used = new_length; \ - } - - #define f_macro_thread_locks_t_adjust(status, locks, new_length) \ - status = f_memory_adjust((void **) & locks.array, sizeof(f_thread_lock_t), locks.size, new_length); \ - if (status == F_none) { \ - locks.size = new_length; \ - if (locks.used > locks.size) locks.used = new_length; \ - } + #define f_macro_thread_locks_t_clear(locks) f_macro_memory_structure_t_clear(locks) + + #define f_macro_thread_locks_t_new(status, locks, length) f_macro_memory_structure_t_new(status, locks, f_thread_lock_t, length) + + #define f_macro_thread_locks_t_delete(status, locks) f_macro_memory_structure_t_delete(status, locks, f_thread_lock_t) + #define f_macro_thread_locks_t_destroy(status, locks) f_macro_memory_structure_t_destroy(status, locks, f_thread_lock_t) + + #define f_macro_thread_locks_t_delete_simple(locks) f_macro_memory_structure_t_delete_simple(locks, f_thread_lock_t) + #define f_macro_thread_locks_t_destroy_simple(locks) f_macro_memory_structure_t_destroy_simple(locks, f_thread_lock_t) + + #define f_macro_thread_locks_t_resize(status, locks, new_length) f_macro_memory_structure_t_resize(status, locks, f_thread_lock_t, new_length) + #define f_macro_thread_locks_t_adjust(status, locks, new_length) f_macro_memory_structure_t_adjust(status, locks, f_thread_lock_t, new_length) #endif // _di_f_thread_locks_t_ /** @@ -445,56 +255,18 @@ extern "C" { #define f_thread_mutexs_t_initialize { 0, 0, 0 } - #define f_macro_thread_mutexs_t_clear(mutexs) \ - mutexs.array = 0; \ - mutexs.size = 0; \ - mutexs.used = 0; - - #define f_macro_thread_mutexs_new(status, mutexs, length) \ - f_macro_thread_mutexs_t_clear(mutexs) \ - status = f_memory_new((void **) & mutexs.array, sizeof(f_thread_mutex_t), length); \ - if (status == F_none) { \ - mutexs.size = length; \ - mutexs.used = 0; \ - } - - #define f_macro_thread_mutexs_t_delete(status, mutexs) \ - status = f_memory_delete((void **) & mutexs.array, sizeof(f_thread_mutex_t), mutexs.size); \ - if (status == F_none) { \ - mutexs.used = 0; \ - mutexs.size = 0; \ - } - - #define f_macro_thread_mutexs_t_destroy(status, mutexs) \ - status = f_memory_destroy((void **) & mutexs.array, sizeof(f_thread_mutex_t), mutexs.size); \ - if (status == F_none) { \ - mutexs.used = 0; \ - mutexs.size = 0; \ - } - - #define f_macro_thread_mutexs_t_delete_simple(mutexs) \ - f_memory_delete((void **) & mutexs.array, sizeof(f_thread_mutex_t), mutexs.size); \ - mutexs.used = 0; \ - mutexs.size = 0; - - #define f_macro_thread_mutexs_t_destroy_simple(mutexs) \ - f_memory_destroy((void **) & mutexs.array, sizeof(f_thread_mutex_t), mutexs.size); \ - mutexs.used = 0; \ - mutexs.size = 0; - - #define f_macro_thread_mutexs_t_resize(status, mutexs, new_length) \ - status = f_memory_resize((void **) & mutexs.array, sizeof(f_thread_mutex_t), mutexs.size, new_length); \ - if (status == F_none) { \ - mutexs.size = new_length; \ - if (mutexs.used > mutexs.size) mutexs.used = new_length; \ - } - - #define f_macro_thread_mutexs_t_adjust(status, mutexs, new_length) \ - status = f_memory_adjust((void **) & mutexs.array, sizeof(f_thread_mutex_t), mutexs.size, new_length); \ - if (status == F_none) { \ - mutexs.size = new_length; \ - if (mutexs.used > mutexs.size) mutexs.used = new_length; \ - } + #define f_macro_thread_mutexs_t_clear(mutexs) f_macro_memory_structure_t_clear(mutexs) + + #define f_macro_thread_mutexs_t_new(status, mutexs, length) f_macro_memory_structure_t_new(status, mutexs, f_thread_mutex_t, length) + + #define f_macro_thread_mutexs_t_delete(status, mutexs) f_macro_memory_structure_t_delete(status, mutexs, f_thread_mutex_t) + #define f_macro_thread_mutexs_t_destroy(status, mutexs) f_macro_memory_structure_t_destroy(status, mutexs, f_thread_mutex_t) + + #define f_macro_thread_mutexs_t_delete_simple(mutexs) f_macro_memory_structure_t_delete_simple(mutexs, f_thread_mutex_t) + #define f_macro_thread_mutexs_t_destroy_simple(mutexs) f_macro_memory_structure_t_destroy_simple(mutexs, f_thread_mutex_t) + + #define f_macro_thread_mutexs_t_resize(status, mutexs, new_length) f_macro_memory_structure_t_resize(status, mutexs, f_thread_mutex_t, new_length) + #define f_macro_thread_mutexs_t_adjust(status, mutexs, new_length) f_macro_memory_structure_t_adjust(status, mutexs, f_thread_mutex_t, new_length) #endif // _di_f_thread_mutexs_t_ /** @@ -525,56 +297,18 @@ extern "C" { #define f_thread_mutex_attributes_t_initialize { 0, 0, 0 } - #define f_macro_thread_mutex_attributes_t_clear(mutex_attributes) \ - mutex_attributes.array = 0; \ - mutex_attributes.size = 0; \ - mutex_attributes.used = 0; - - #define f_macro_thread_mutex_attributes_new(status, mutex_attributes, length) \ - f_macro_thread_mutex_attributes_t_clear(mutex_attributes) \ - status = f_memory_new((void **) & mutex_attributes.array, sizeof(f_thread_mutex_attribute_t), length); \ - if (status == F_none) { \ - mutex_attributes.size = length; \ - mutex_attributes.used = 0; \ - } - - #define f_macro_thread_mutex_attributes_t_delete(status, mutex_attributes) \ - status = f_memory_delete((void **) & mutex_attributes.array, sizeof(f_thread_mutex_attribute_t), mutex_attributes.size); \ - if (status == F_none) { \ - mutex_attributes.used = 0; \ - mutex_attributes.size = 0; \ - } - - #define f_macro_thread_mutex_attributes_t_destroy(status, mutex_attributes) \ - status = f_memory_destroy((void **) & mutex_attributes.array, sizeof(f_thread_mutex_attribute_t), mutex_attributes.size); \ - if (status == F_none) { \ - mutex_attributes.used = 0; \ - mutex_attributes.size = 0; \ - } - - #define f_macro_thread_mutex_attributes_t_delete_simple(mutex_attributes) \ - f_memory_delete((void **) & mutex_attributes.array, sizeof(f_thread_mutex_attribute_t), mutex_attributes.size); \ - mutex_attributes.used = 0; \ - mutex_attributes.size = 0; - - #define f_macro_thread_mutex_attributes_t_destroy_simple(mutex_attributes) \ - f_memory_destroy((void **) & mutex_attributes.array, sizeof(f_thread_mutex_attribute_t), mutex_attributes.size); \ - mutex_attributes.used = 0; \ - mutex_attributes.size = 0; - - #define f_macro_thread_mutex_attributes_t_resize(status, mutex_attributes, new_length) \ - status = f_memory_resize((void **) & mutex_attributes.array, sizeof(f_thread_mutex_attribute_t), mutex_attributes.size, new_length); \ - if (status == F_none) { \ - mutex_attributes.size = new_length; \ - if (mutex_attributes.used > mutex_attributes.size) mutex_attributes.used = new_length; \ - } - - #define f_macro_thread_mutex_attributes_t_adjust(status, mutex_attributes, new_length) \ - status = f_memory_adjust((void **) & mutex_attributes.array, sizeof(f_thread_mutex_attribute_t), mutex_attributes.size, new_length); \ - if (status == F_none) { \ - mutex_attributes.size = new_length; \ - if (mutex_attributes.used > mutex_attributes.size) mutex_attributes.used = new_length; \ - } + #define f_macro_thread_mutex_attributes_t_clear(mutex_attributes) f_macro_memory_structure_t_clear(mutex_attributes) + + #define f_macro_thread_mutex_attributes_t_new(status, mutex_attributes, length) f_macro_memory_structure_t_new(status, mutex_attributes, f_thread_mutex_attribute_t, length) + + #define f_macro_thread_mutex_attributes_t_delete(status, mutex_attributes) f_macro_memory_structure_t_delete(status, mutex_attributes, f_thread_mutex_attribute_t) + #define f_macro_thread_mutex_attributes_t_destroy(status, mutex_attributes) f_macro_memory_structure_t_destroy(status, mutex_attributes, f_thread_mutex_attribute_t) + + #define f_macro_thread_mutex_attributes_t_delete_simple(mutex_attributes) f_macro_memory_structure_t_delete_simple(mutex_attributes, f_thread_mutex_attribute_t) + #define f_macro_thread_mutex_attributes_t_destroy_simple(mutex_attributes) f_macro_memory_structure_t_destroy_simple(mutex_attributes, f_thread_mutex_attribute_t) + + #define f_macro_thread_mutex_attributes_t_resize(status, mutex_attributes, new_length) f_macro_memory_structure_t_resize(status, mutex_attributes, f_thread_mutex_attribute_t, new_length) + #define f_macro_thread_mutex_attributes_t_adjust(status, mutex_attributes, new_length) f_macro_memory_structure_t_adjust(status, mutex_attributes, f_thread_mutex_attribute_t, new_length) #endif // _di_f_thread_mutex_attributes_t_ /** @@ -605,56 +339,18 @@ extern "C" { #define f_thread_onces_t_initialize { 0, 0, 0 } - #define f_macro_thread_onces_t_clear(onces) \ - onces.array = 0; \ - onces.size = 0; \ - onces.used = 0; - - #define f_macro_thread_onces_new(status, onces, length) \ - f_macro_thread_onces_t_clear(onces) \ - status = f_memory_new((void **) & onces.array, sizeof(f_thread_once_t), length); \ - if (status == F_none) { \ - onces.size = length; \ - onces.used = 0; \ - } - - #define f_macro_thread_onces_t_delete(status, onces) \ - status = f_memory_delete((void **) & onces.array, sizeof(f_thread_once_t), onces.size); \ - if (status == F_none) { \ - onces.used = 0; \ - onces.size = 0; \ - } - - #define f_macro_thread_onces_t_destroy(status, onces) \ - status = f_memory_destroy((void **) & onces.array, sizeof(f_thread_once_t), onces.size); \ - if (status == F_none) { \ - onces.used = 0; \ - onces.size = 0; \ - } - - #define f_macro_thread_onces_t_delete_simple(onces) \ - f_memory_delete((void **) & onces.array, sizeof(f_thread_once_t), onces.size); \ - onces.used = 0; \ - onces.size = 0; - - #define f_macro_thread_onces_t_destroy_simple(onces) \ - f_memory_destroy((void **) & onces.array, sizeof(f_thread_once_t), onces.size); \ - onces.used = 0; \ - onces.size = 0; - - #define f_macro_thread_onces_t_resize(status, onces, new_length) \ - status = f_memory_resize((void **) & onces.array, sizeof(f_thread_once_t), onces.size, new_length); \ - if (status == F_none) { \ - onces.size = new_length; \ - if (onces.used > onces.size) onces.used = new_length; \ - } - - #define f_macro_thread_onces_t_adjust(status, onces, new_length) \ - status = f_memory_adjust((void **) & onces.array, sizeof(f_thread_once_t), onces.size, new_length); \ - if (status == F_none) { \ - onces.size = new_length; \ - if (onces.used > onces.size) onces.used = new_length; \ - } + #define f_macro_thread_onces_t_clear(onces) f_macro_memory_structure_t_clear(onces) + + #define f_macro_thread_onces_t_new(status, onces, length) f_macro_memory_structure_t_new(status, onces, f_thread_once_t, length) + + #define f_macro_thread_onces_t_delete(status, onces) f_macro_memory_structure_t_delete(status, onces, f_thread_once_t) + #define f_macro_thread_onces_t_destroy(status, onces) f_macro_memory_structure_t_destroy(status, onces, f_thread_once_t) + + #define f_macro_thread_onces_t_delete_simple(onces) f_macro_memory_structure_t_delete_simple(onces, f_thread_once_t) + #define f_macro_thread_onces_t_destroy_simple(onces) f_macro_memory_structure_t_destroy_simple(onces, f_thread_once_t) + + #define f_macro_thread_onces_t_resize(status, onces, new_length) f_macro_memory_structure_t_resize(status, onces, f_thread_once_t, new_length) + #define f_macro_thread_onces_t_adjust(status, onces, new_length) f_macro_memory_structure_t_adjust(status, onces, f_thread_once_t, new_length) #endif // _di_f_thread_onces_t_ /** @@ -673,7 +369,6 @@ extern "C" { #define f_thread_set_t_initialize { f_thread_attribute_t_initialize, f_thread_id_t_initialize, 0 } - #define f_macro_thread_set_t_clear(thread) \ f_macro_thread_attribute_t_clear(thread.attributes) \ f_macro_thread_id_t_clear(thread.id) @@ -696,56 +391,18 @@ extern "C" { #define f_thread_sets_t_initialize { 0, 0, 0 } - #define f_macro_thread_sets_t_clear(threads) \ - threads.array = 0; \ - threads.size = 0; \ - threads.used = 0; - - #define f_macro_thread_sets_new(status, threads, length) \ - f_macro_thread_sets_t_clear(threads) \ - status = f_memory_new((void **) & threads.array, sizeof(f_thread_set_t), length); \ - if (status == F_none) { \ - threads.size = length; \ - threads.used = 0; \ - } - - #define f_macro_thread_sets_t_delete(status, threads) \ - status = f_memory_delete((void **) & threads.array, sizeof(f_thread_set_t), threads.size); \ - if (status == F_none) { \ - threads.used = 0; \ - threads.size = 0; \ - } - - #define f_macro_thread_sets_t_destroy(status, threads) \ - status = f_memory_destroy((void **) & threads.array, sizeof(f_thread_set_t), threads.size); \ - if (status == F_none) { \ - threads.used = 0; \ - threads.size = 0; \ - } - - #define f_macro_thread_sets_t_delete_simple(threads) \ - f_memory_delete((void **) & threads.array, sizeof(f_thread_set_t), threads.size); \ - threads.used = 0; \ - threads.size = 0; - - #define f_macro_thread_sets_t_destroy_simple(threads) \ - f_memory_destroy((void **) & threads.array, sizeof(f_thread_set_t), threads.size); \ - threads.used = 0; \ - threads.size = 0; - - #define f_macro_thread_sets_t_resize(status, threads, new_length) \ - status = f_memory_resize((void **) & threads.array, sizeof(f_thread_set_t), threads.size, new_length); \ - if (status == F_none) { \ - threads.size = new_length; \ - if (threads.used > threads.size) threads.used = new_length; \ - } - - #define f_macro_thread_sets_t_adjust(status, threads, new_length) \ - status = f_memory_adjust((void **) & threads.array, sizeof(f_thread_set_t), threads.size, new_length); \ - if (status == F_none) { \ - threads.size = new_length; \ - if (threads.used > threads.size) threads.used = new_length; \ - } + #define f_macro_thread_sets_t_clear(sets) f_macro_memory_structure_t_clear(sets) + + #define f_macro_thread_sets_t_new(status, sets, length) f_macro_memory_structure_t_new(status, sets, f_thread_set_t, length) + + #define f_macro_thread_sets_t_delete(status, sets) f_macro_memory_structure_t_delete(status, sets, f_thread_set_t) + #define f_macro_thread_sets_t_destroy(status, sets) f_macro_memory_structure_t_destroy(status, sets, f_thread_set_t) + + #define f_macro_thread_sets_t_delete_simple(sets) f_macro_memory_structure_t_delete_simple(sets, f_thread_set_t) + #define f_macro_thread_sets_t_destroy_simple(sets) f_macro_memory_structure_t_destroy_simple(sets, f_thread_set_t) + + #define f_macro_thread_sets_t_resize(status, sets, new_length) f_macro_memory_structure_t_resize(status, sets, f_thread_set_t, new_length) + #define f_macro_thread_sets_t_adjust(status, sets, new_length) f_macro_memory_structure_t_adjust(status, sets, f_thread_set_t, new_length) #endif // _di_f_thread_sets_t_ #ifdef __cplusplus -- 1.8.3.1