From: Kevin Day Date: Thu, 10 Aug 2023 04:33:16 +0000 (-0500) Subject: Progress: Continue re-designing of the memory logic. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=9adef8a2cd6cc551675b7a335a0db51a346c77c6;p=fll Progress: Continue re-designing of the memory logic. I did a first pass through the f_thread related memory code. There could be a second pass through the f_thread, but for now this is good enough. I spent some time going through the build process and other such code to get unit tests running with the latest progress commits. Fix mistake in f_file_stream_read() where F_none_eof is returned but F_none should be returned. Include cleanup commit f6725366474492f1b7baabba7938854f6e6412eb from 0.6 branch. --- diff --git a/build/level_0/settings b/build/level_0/settings index 5b70fde..84b32ef 100644 --- a/build/level_0/settings +++ b/build/level_0/settings @@ -92,7 +92,6 @@ build_sources_library utf/private-string.c build_sources_library utf/private-triples.c utf/private-tripless.c build_sources_library-thread thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/condition.c thread/condition_attribute.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/mutex.c thread/mutex_attribute.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c -build_sources_library-thread thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c build_sources_headers account.h account/accounts.h account/common.h build_sources_headers capability.h capability/common.h diff --git a/build/monolithic/settings b/build/monolithic/settings index be2a47c..dff44ad 100644 --- a/build/monolithic/settings +++ b/build/monolithic/settings @@ -113,7 +113,6 @@ build_sources_library level_2/print.c build_sources_library level_2/program.c level_2/program/common.c level_2/program/print.c level_2/private-program.c build_sources_library-thread level_0/thread.c level_0/thread/attribute.c level_0/thread/barrier.c level_0/thread/barrier_attribute.c level_0/thread/condition.c level_0/thread/condition_attribute.c level_0/thread/id.c level_0/thread/key.c level_0/thread/lock.c level_0/thread/lock_attribute.c level_0/thread/mutex.c level_0/thread/mutex_attribute.c level_0/thread/once.c level_0/thread/semaphore.c level_0/thread/set.c level_0/thread/spin.c -build_sources_library-thread level_0/thread/private-barrier.c level_0/thread/private-barrier_attribute.c level_0/thread/private-condition.c level_0/thread/private-condition_attribute.c build_sources_headers level_0/account.h level_0/account/accounts.h level_0/account/common.h build_sources_headers level_0/capability.h level_0/capability/common.h diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index 65d6553..1d824a9 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -84,22 +84,8 @@ #define _di_f_capability_to_name_ #define _di_f_capability_to_text_ #define _di_f_capability_user_set_ -#define _di_f_cells_adjust_ -#define _di_f_cells_append_ -#define _di_f_cells_append_all_ -#define _di_f_cells_decimate_by_ -#define _di_f_cells_decrease_by_ -#define _di_f_cells_increase_ -#define _di_f_cells_increase_by_ -#define _di_f_cells_resize_ -#define _di_f_cellss_adjust_ -#define _di_f_cellss_append_ -#define _di_f_cellss_append_all_ -#define _di_f_cellss_decimate_by_ -#define _di_f_cellss_decrease_by_ -#define _di_f_cellss_increase_ -#define _di_f_cellss_increase_by_ -#define _di_f_cellss_resize_ +#define _di_f_cells_adjust_callback_ +#define _di_f_cells_resize_callback_ #define _di_f_cellss_t_ #define _di_f_cells_t_ #define _di_f_cell_t_ @@ -360,6 +346,7 @@ //#define _di_f_file_at_d_ //#define _di_f_file_clone_ //#define _di_f_file_close_ +#define _di_f_file_close_id_ //#define _di_f_file_copy_ //#define _di_f_file_create_ #define _di_f_file_create_at_ @@ -459,29 +446,15 @@ #define _di_f_file_rename_at_ //#define _di_f_file_role_change_ #define _di_f_file_role_change_at_ -#define _di_f_files_adjust_ -#define _di_f_files_append_ -#define _di_f_files_append_all_ -#define _di_f_files_decimate_by_ -#define _di_f_files_decrease_by_ +#define _di_f_files_adjust_callback_ #define _di_f_file_seek_ #define _di_f_file_seeks_d_ #define _di_f_file_select_ #define _di_f_file_select_signal_ -#define _di_f_files_increase_ -#define _di_f_files_increase_by_ //#define _di_f_file_size_ #define _di_f_file_size_at_ #define _di_f_file_size_by_id_ -#define _di_f_files_resize_ -#define _di_f_filess_adjust_ -#define _di_f_filess_append_ -#define _di_f_filess_append_all_ -#define _di_f_filess_decimate_by_ -#define _di_f_filess_decrease_by_ -#define _di_f_filess_increase_ -#define _di_f_filess_increase_by_ -#define _di_f_filess_resize_ +#define _di_f_files_resize_callback_ #define _di_f_filess_t_ #define _di_f_files_t_ //#define _di_f_file_stat_ @@ -528,22 +501,8 @@ #define _di_f_file_write_range_ #define _di_f_file_write_until #define _di_f_file_write_until_ -#define _di_f_fll_ids_adjust_ -#define _di_f_fll_ids_append_ -#define _di_f_fll_ids_append_all_ -#define _di_f_fll_ids_decimate_by_ -#define _di_f_fll_ids_decrease_by_ -#define _di_f_fll_ids_increase_ -#define _di_f_fll_ids_increase_by_ -#define _di_f_fll_ids_resize_ -#define _di_f_fll_idss_adjust_ -#define _di_f_fll_idss_append_ -#define _di_f_fll_idss_append_all_ -#define _di_f_fll_idss_decimate_by_ -#define _di_f_fll_idss_decrease_by_ -#define _di_f_fll_idss_increase_ -#define _di_f_fll_idss_increase_by_ -#define _di_f_fll_idss_resize_ +#define _di_f_fll_ids_adjust_callback_ +#define _di_f_fll_ids_resize_callback_ #define _di_f_fll_idss_t_ #define _di_f_fll_ids_t_ #define _di_f_fll_id_t_ @@ -631,6 +590,8 @@ #define _di_f_fss_sets_t_ //#define _di_f_fss_set_t_ #define _di_f_fss_simple_packet_d_ +#define _di_f_fss_simple_packet_delete_ +#define _di_f_fss_simple_packet_destroy_ #define _di_f_fss_simple_packet_identify_ #define _di_f_fss_simple_packet_ranges_adjust_ #define _di_f_fss_simple_packet_ranges_append_ @@ -651,6 +612,25 @@ #define _di_f_fss_simple_packet_rangess_t_ #define _di_f_fss_simple_packet_ranges_t_ #define _di_f_fss_simple_packet_range_t_ +#define _di_f_fss_simple_packets_adjust_ +#define _di_f_fss_simple_packets_append_ +#define _di_f_fss_simple_packets_append_all_ +#define _di_f_fss_simple_packets_decimate_by_ +#define _di_f_fss_simple_packets_decrease_by_ +#define _di_f_fss_simple_packets_increase_ +#define _di_f_fss_simple_packets_increase_by_ +#define _di_f_fss_simple_packets_resize_ +#define _di_f_fss_simple_packetss_adjust_ +#define _di_f_fss_simple_packetss_append_ +#define _di_f_fss_simple_packetss_append_all_ +#define _di_f_fss_simple_packetss_decimate_by_ +#define _di_f_fss_simple_packetss_decrease_by_ +#define _di_f_fss_simple_packetss_increase_ +#define _di_f_fss_simple_packetss_increase_by_ +#define _di_f_fss_simple_packetss_resize_ +#define _di_f_fss_simple_packetss_t_ +#define _di_f_fss_simple_packets_t_ +#define _di_f_fss_simple_packet_t_ //#define _di_f_fss_skip_past_delimit_ //#define _di_f_fss_skip_past_space_ //#define _di_f_fss_state_flag_e_ @@ -736,98 +716,27 @@ //#define _di_f_iki_vocabulary_0002_define_s_ //#define _di_f_iki_vocabulary_0002_parameter_s_ //#define _di_f_iki_vocabulary_0002_s_ -#define _di_f_int128s_adjust_ -#define _di_f_int128s_append_ -#define _di_f_int128s_append_all_ -#define _di_f_int128s_decimate_by_ -#define _di_f_int128s_decrease_by_ -#define _di_f_int128s_increase_ -#define _di_f_int128s_increase_by_ -#define _di_f_int128s_resize_ -#define _di_f_int128ss_adjust_ -#define _di_f_int128ss_append_ -#define _di_f_int128ss_append_all_ -#define _di_f_int128ss_decimate_by_ -#define _di_f_int128ss_decrease_by_ -#define _di_f_int128ss_increase_ -#define _di_f_int128ss_increase_by_ -#define _di_f_int128ss_resize_ +#define _di_f_int128s_adjust_callback_ +#define _di_f_int128s_resize_callback_ #define _di_f_int128ss_t_ #define _di_f_int128s_t_ //#define _di_f_int128_t_ -#define _di_f_int16s_adjust_ -#define _di_f_int16s_append_ -#define _di_f_int16s_append_all_ -#define _di_f_int16s_decimate_by_ -#define _di_f_int16s_decrease_by_ -#define _di_f_int16s_increase_ -#define _di_f_int16s_increase_by_ -#define _di_f_int16s_resize_ -#define _di_f_int16ss_adjust_ -#define _di_f_int16ss_append_ -#define _di_f_int16ss_append_all_ -#define _di_f_int16ss_decimate_by_ -#define _di_f_int16ss_decrease_by_ -#define _di_f_int16ss_increase_ -#define _di_f_int16ss_increase_by_ -#define _di_f_int16ss_resize_ +#define _di_f_int16s_adjust_callback_ +#define _di_f_int16s_resize_callback_ #define _di_f_int16ss_t_ #define _di_f_int16s_t_ -#define _di_f_int32s_adjust_ -#define _di_f_int32s_append_ -#define _di_f_int32s_append_all_ -#define _di_f_int32s_decimate_by_ -#define _di_f_int32s_decrease_by_ -#define _di_f_int32s_increase_ -#define _di_f_int32s_increase_by_ -#define _di_f_int32s_resize_ -#define _di_f_int32ss_adjust_ -#define _di_f_int32ss_append_ -#define _di_f_int32ss_append_all_ -#define _di_f_int32ss_decimate_by_ -#define _di_f_int32ss_decrease_by_ -#define _di_f_int32ss_increase_ -#define _di_f_int32ss_increase_by_ -#define _di_f_int32ss_resize_ +#define _di_f_int32s_adjust_callback_ +#define _di_f_int32s_resize_callback_ #define _di_f_int32ss_t_ //#define _di_f_int32s_t_ -#define _di_f_int64s_adjust_ -#define _di_f_int64s_append_ -#define _di_f_int64s_append_all_ -#define _di_f_int64s_decimate_by_ -#define _di_f_int64s_decrease_by_ -#define _di_f_int64s_increase_ -#define _di_f_int64s_increase_by_ -#define _di_f_int64s_resize_ -#define _di_f_int64ss_adjust_ -#define _di_f_int64ss_append_ -#define _di_f_int64ss_append_all_ -#define _di_f_int64ss_decimate_by_ -#define _di_f_int64ss_decrease_by_ -#define _di_f_int64ss_increase_ -#define _di_f_int64ss_increase_by_ -#define _di_f_int64ss_resize_ +#define _di_f_int64s_adjust_callback_ +#define _di_f_int64s_resize_callback_ #define _di_f_int64ss_t_ #define _di_f_int64s_t_ -#define _di_f_int8s_adjust_ -#define _di_f_int8s_append_ -#define _di_f_int8s_append_all_ -#define _di_f_int8s_decimate_by_ -#define _di_f_int8s_decrease_by_ -#define _di_f_int8s_increase_ -#define _di_f_int8s_increase_by_ -#define _di_f_int8s_resize_ -#define _di_f_int8ss_adjust_ -#define _di_f_int8ss_append_ -#define _di_f_int8ss_append_all_ -#define _di_f_int8ss_decimate_by_ -#define _di_f_int8ss_decrease_by_ -#define _di_f_int8ss_increase_ -#define _di_f_int8ss_increase_by_ -#define _di_f_int8ss_resize_ +#define _di_f_int8s_adjust_callback_ +#define _di_f_int8s_resize_callback_ #define _di_f_int8ss_t_ #define _di_f_int8s_t_ -#define _di_f_int8_t_ //#define _di_fl_control_group_apply_ //#define _di_fl_conversion_data_base_10_c_ #define _di_fl_conversion_data_base_12_c_ @@ -1152,11 +1061,15 @@ //#define _di_fl_print_warning_s_ #define _di_f_memory_adjust_ #define _di_f_memory_array_adjust_ +#define _di_f_memory_array_append_ +#define _di_f_memory_array_append_all_ #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_resize_ +#define _di_f_memory_arrays_adjust_ +//#define _di_f_memory_arrays_resize_ //#define _di_f_memory_default_d_ //#define _di_f_memory_delete_ #define _di_f_memory_destroy_ @@ -1176,22 +1089,8 @@ #define _di_f_network_to_host_long_ #define _di_f_network_to_host_short_ #define _di_f_network_to_ip_string_ -#define _di_f_number_unsigneds_adjust_ -#define _di_f_number_unsigneds_append_ -#define _di_f_number_unsigneds_append_all_ -#define _di_f_number_unsigneds_decimate_by_ -#define _di_f_number_unsigneds_decrease_by_ -//#define _di_f_number_unsigneds_increase_ -//#define _di_f_number_unsigneds_increase_by_ -//#define _di_f_number_unsigneds_resize_ -#define _di_f_number_unsignedss_adjust_ -#define _di_f_number_unsignedss_append_ -#define _di_f_number_unsignedss_append_all_ -#define _di_f_number_unsignedss_decimate_by_ -#define _di_f_number_unsignedss_decrease_by_ -#define _di_f_number_unsignedss_increase_ -#define _di_f_number_unsignedss_increase_by_ -#define _di_f_number_unsignedss_resize_ +#define _di_f_number_unsigneds_adjust_callback_ +#define _di_f_number_unsigneds_resize_callback_ #define _di_f_number_unsignedss_t_ //#define _di_f_number_unsigneds_t_ #define _di_f_parse_dynamic_partial_fll_identify_ @@ -1285,22 +1184,8 @@ //#define _di_f_pipe_input_exists_ #define _di_f_pipe_output_exists_ //#define _di_f_poll_e_ -#define _di_f_polls_adjust_ -#define _di_f_polls_append_ -#define _di_f_polls_append_all_ -#define _di_f_polls_decimate_by_ -#define _di_f_polls_decrease_by_ -#define _di_f_polls_increase_ -#define _di_f_polls_increase_by_ -#define _di_f_polls_resize_ -#define _di_f_pollss_adjust_ -#define _di_f_pollss_append_ -#define _di_f_pollss_append_all_ -#define _di_f_pollss_decimate_by_ -#define _di_f_pollss_decrease_by_ -#define _di_f_pollss_increase_ -#define _di_f_pollss_increase_by_ -#define _di_f_pollss_resize_ +#define _di_f_polls_adjust_callback_ +#define _di_f_polls_resize_callback_ #define _di_f_pollss_t_ #define _di_f_polls_t_ //#define _di_f_poll_t_ @@ -1520,22 +1405,8 @@ #define _di_f_socket_write_ #define _di_f_socket_write_message_ #define _di_f_socket_write_stream_ -#define _di_f_states_adjust_ -#define _di_f_states_append_ -#define _di_f_states_append_all_ -#define _di_f_states_decimate_by_ -#define _di_f_states_decrease_by_ -#define _di_f_states_increase_ -#define _di_f_states_increase_by_ -#define _di_f_states_resize_ -#define _di_f_statess_adjust_ -#define _di_f_statess_append_ -#define _di_f_statess_append_all_ -#define _di_f_statess_decimate_by_ -#define _di_f_statess_decrease_by_ -#define _di_f_statess_increase_ -#define _di_f_statess_increase_by_ -#define _di_f_statess_resize_ +#define _di_f_states_adjust_callback_ +#define _di_f_states_resize_callback_ #define _di_f_statess_t_ #define _di_f_states_t_ //#define _di_f_state_t_ @@ -1557,24 +1428,10 @@ //#define _di_f_status_number_e_ //#define _di_f_status_process_e_ //#define _di_f_status_return_e_ -#define _di_f_statuss_adjust_ -#define _di_f_statuss_append_ -#define _di_f_statuss_append_all_ -#define _di_f_statuss_decimate_by_ -#define _di_f_statuss_decrease_by_ +#define _di_f_statuss_adjust_callback_ //#define _di_f_status_signal_e_ -#define _di_f_statuss_increase_ -#define _di_f_statuss_increase_by_ //#define _di_f_status_socket_e_ -#define _di_f_statuss_resize_ -#define _di_f_statusss_adjust_ -#define _di_f_statusss_append_ -#define _di_f_statusss_append_all_ -#define _di_f_statusss_decimate_by_ -#define _di_f_statusss_decrease_by_ -#define _di_f_statusss_increase_ -#define _di_f_statusss_increase_by_ -#define _di_f_statusss_resize_ +#define _di_f_statuss_resize_callback_ #define _di_f_statusss_t_ #define _di_f_statuss_t_ //#define _di_f_status_t_ @@ -1780,7 +1637,6 @@ #define _di_f_thread_attribute_scope_get_ #define _di_f_thread_attribute_scope_set_ #define _di_f_thread_attributes_decimate_by_ -#define _di_f_thread_attributes_decrease_ #define _di_f_thread_attributes_decrease_by_ #define _di_f_thread_attributes_increase_ #define _di_f_thread_attributes_increase_by_ @@ -1795,7 +1651,6 @@ #define _di_f_thread_barrier_attribute_delete_ #define _di_f_thread_barrier_attributes_adjust_ #define _di_f_thread_barrier_attributes_decimate_by_ -#define _di_f_thread_barrier_attributes_decrease_ #define _di_f_thread_barrier_attributes_decrease_by_ #define _di_f_thread_barrier_attribute_shared_get_ #define _di_f_thread_barrier_attribute_shared_set_ @@ -1808,7 +1663,6 @@ #define _di_f_thread_barrier_delete_ #define _di_f_thread_barriers_adjust_ #define _di_f_thread_barriers_decimate_by_ -#define _di_f_thread_barriers_decrease_ #define _di_f_thread_barriers_decrease_by_ #define _di_f_thread_barriers_increase_ #define _di_f_thread_barriers_increase_by_ @@ -1829,7 +1683,6 @@ #define _di_f_thread_condition_attribute_delete_ #define _di_f_thread_condition_attributes_adjust_ #define _di_f_thread_condition_attributes_decimate_by_ -#define _di_f_thread_condition_attributes_decrease_ #define _di_f_thread_condition_attributes_decrease_by_ #define _di_f_thread_condition_attribute_shared_get_ #define _di_f_thread_condition_attribute_shared_set_ @@ -1842,7 +1695,6 @@ #define _di_f_thread_condition_delete_ #define _di_f_thread_conditions_adjust_ #define _di_f_thread_conditions_decimate_by_ -#define _di_f_thread_conditions_decrease_ #define _di_f_thread_conditions_decrease_by_ #define _di_f_thread_condition_signal_ #define _di_f_thread_condition_signal_all_ @@ -1872,7 +1724,6 @@ #define _di_f_thread_key_get_ #define _di_f_thread_keys_adjust_ #define _di_f_thread_keys_decimate_by_ -#define _di_f_thread_keys_decrease_ #define _di_f_thread_keys_decrease_by_ #define _di_f_thread_key_set_ #define _di_f_thread_keys_increase_ @@ -1884,7 +1735,6 @@ #define _di_f_thread_lock_attribute_delete_ #define _di_f_thread_lock_attributes_adjust_ #define _di_f_thread_lock_attributes_decimate_by_ -#define _di_f_thread_lock_attributes_decrease_ #define _di_f_thread_lock_attributes_decrease_by_ #define _di_f_thread_lock_attribute_shared_get_ #define _di_f_thread_lock_attribute_shared_set_ @@ -1900,7 +1750,6 @@ #define _di_f_thread_lock_read_try_ #define _di_f_thread_locks_adjust_ #define _di_f_thread_locks_decimate_by_ -#define _di_f_thread_locks_decrease_ #define _di_f_thread_locks_decrease_by_ #define _di_f_thread_locks_increase_ #define _di_f_thread_locks_increase_by_ @@ -1918,7 +1767,6 @@ #define _di_f_thread_mutex_attribute_protocol_set_ #define _di_f_thread_mutex_attributes_adjust_ #define _di_f_thread_mutex_attributes_decimate_by_ -#define _di_f_thread_mutex_attributes_decrease_ #define _di_f_thread_mutex_attributes_decrease_by_ #define _di_f_thread_mutex_attribute_shared_get_ #define _di_f_thread_mutex_attribute_shared_set_ @@ -1938,7 +1786,6 @@ #define _di_f_thread_mutex_priority_ceiling_set_ #define _di_f_thread_mutexs_adjust_ #define _di_f_thread_mutexs_decimate_by_ -#define _di_f_thread_mutexs_decrease_ #define _di_f_thread_mutexs_decrease_by_ #define _di_f_thread_mutexs_increase_ #define _di_f_thread_mutexs_increase_by_ @@ -1968,7 +1815,6 @@ #define _di_f_thread_semaphore_lock_try_ #define _di_f_thread_semaphores_adjust_ #define _di_f_thread_semaphores_decimate_by_ -#define _di_f_thread_semaphores_decrease_ #define _di_f_thread_semaphores_decrease_by_ #define _di_f_thread_semaphores_increase_ #define _di_f_thread_semaphores_increase_by_ @@ -1979,7 +1825,6 @@ #define _di_f_thread_semaphore_value_get_ #define _di_f_thread_sets_adjust_ #define _di_f_thread_sets_decimate_by_ -#define _di_f_thread_sets_decrease_ #define _di_f_thread_sets_decrease_by_ #define _di_f_thread_sets_increase_ #define _di_f_thread_sets_increase_by_ @@ -1995,7 +1840,6 @@ #define _di_f_thread_spin_lock_try_ #define _di_f_thread_spins_adjust_ #define _di_f_thread_spins_decimate_by_ -#define _di_f_thread_spins_decrease_ #define _di_f_thread_spins_decrease_by_ #define _di_f_thread_spins_increase_ #define _di_f_thread_spins_increase_by_ @@ -2013,95 +1857,25 @@ //#define _di_f_type_file_flag_d_ //#define _di_f_type_number_64_t_ //#define _di_f_type_sizes_d_ -#define _di_f_uint128s_adjust_ -#define _di_f_uint128s_append_ -#define _di_f_uint128s_append_all_ -#define _di_f_uint128s_decimate_by_ -#define _di_f_uint128s_decrease_by_ -#define _di_f_uint128s_increase_ -#define _di_f_uint128s_increase_by_ -#define _di_f_uint128s_resize_ -#define _di_f_uint128ss_adjust_ -#define _di_f_uint128ss_append_ -#define _di_f_uint128ss_append_all_ -#define _di_f_uint128ss_decimate_by_ -#define _di_f_uint128ss_decrease_by_ -#define _di_f_uint128ss_increase_ -#define _di_f_uint128ss_increase_by_ -#define _di_f_uint128ss_resize_ +#define _di_f_uint128s_adjust_callback_ +#define _di_f_uint128s_resize_callback_ #define _di_f_uint128ss_t_ #define _di_f_uint128s_t_ -#define _di_f_uint128_t_ -#define _di_f_uint16s_adjust_ -#define _di_f_uint16s_append_ -#define _di_f_uint16s_append_all_ -#define _di_f_uint16s_decimate_by_ -#define _di_f_uint16s_decrease_by_ -#define _di_f_uint16s_increase_ -#define _di_f_uint16s_increase_by_ -#define _di_f_uint16s_resize_ -#define _di_f_uint16ss_adjust_ -#define _di_f_uint16ss_append_ -#define _di_f_uint16ss_append_all_ -#define _di_f_uint16ss_decimate_by_ -#define _di_f_uint16ss_decrease_by_ -#define _di_f_uint16ss_increase_ -#define _di_f_uint16ss_increase_by_ -#define _di_f_uint16ss_resize_ +//#define _di_f_uint128_t_ +#define _di_f_uint16s_adjust_callback_ +#define _di_f_uint16s_resize_callback_ #define _di_f_uint16ss_t_ //#define _di_f_uint16s_t_ -#define _di_f_uint32s_adjust_ -#define _di_f_uint32s_append_ -#define _di_f_uint32s_append_all_ -#define _di_f_uint32s_decimate_by_ -#define _di_f_uint32s_decrease_by_ -#define _di_f_uint32s_increase_ -#define _di_f_uint32s_increase_by_ -#define _di_f_uint32s_resize_ -#define _di_f_uint32ss_adjust_ -#define _di_f_uint32ss_append_ -#define _di_f_uint32ss_append_all_ -#define _di_f_uint32ss_decimate_by_ -#define _di_f_uint32ss_decrease_by_ -#define _di_f_uint32ss_increase_ -#define _di_f_uint32ss_increase_by_ -#define _di_f_uint32ss_resize_ +#define _di_f_uint32s_adjust_callback_ +#define _di_f_uint32s_resize_callback_ #define _di_f_uint32ss_t_ #define _di_f_uint32s_t_ -#define _di_f_uint64s_adjust_ -#define _di_f_uint64s_append_ -#define _di_f_uint64s_append_all_ -#define _di_f_uint64s_decimate_by_ -#define _di_f_uint64s_decrease_by_ -#define _di_f_uint64s_increase_ -#define _di_f_uint64s_increase_by_ -#define _di_f_uint64s_resize_ -#define _di_f_uint64ss_adjust_ -#define _di_f_uint64ss_append_ -#define _di_f_uint64ss_append_all_ -#define _di_f_uint64ss_decimate_by_ -#define _di_f_uint64ss_decrease_by_ -#define _di_f_uint64ss_increase_ -#define _di_f_uint64ss_increase_by_ -#define _di_f_uint64ss_resize_ +#define _di_f_uint64s_adjust_callback_ +#define _di_f_uint64s_resize_callback_ #define _di_f_uint64ss_t_ #define _di_f_uint64s_t_ -#define _di_f_uint8s_adjust_ -#define _di_f_uint8s_append_ -#define _di_f_uint8s_append_all_ -#define _di_f_uint8s_decimate_by_ -#define _di_f_uint8s_decrease_by_ -//#define _di_f_uint8s_increase_ -//#define _di_f_uint8s_increase_by_ -//#define _di_f_uint8s_resize_ -#define _di_f_uint8ss_adjust_ -#define _di_f_uint8ss_append_ -#define _di_f_uint8ss_append_all_ -#define _di_f_uint8ss_decimate_by_ -#define _di_f_uint8ss_decrease_by_ -//#define _di_f_uint8ss_increase_ -#define _di_f_uint8ss_increase_by_ -//#define _di_f_uint8ss_resize_ +#define _di_f_uint8s_adjust_callback_ +//#define _di_f_uint8s_resize_callback_ //#define _di_f_uint8ss_t_ //#define _di_f_uint8s_t_ #define _di_f_utf_buffer_decrement_ @@ -2307,8 +2081,8 @@ #define _di_f_utf_string_mapss_increase_by_ #define _di_f_utf_string_mapss_resize_ #define _di_f_utf_string_mapss_t_ -//#define _di_f_utf_string_maps_t_ -//#define _di_f_utf_string_map_t_ +#define _di_f_utf_string_maps_t_ +#define _di_f_utf_string_map_t_ #define _di_f_utf_string_mash_ #define _di_f_utf_string_mash_nulless_ #define _di_f_utf_string_mish_ diff --git a/build/stand_alone/fake.settings b/build/stand_alone/fake.settings index 3420196..634877b 100644 --- a/build/stand_alone/fake.settings +++ b/build/stand_alone/fake.settings @@ -46,7 +46,7 @@ build_sources_program fll/level_0/fss.c fll/level_0/fss/common.c fll/level_0/fss build_sources_program fll/level_0/fss/private-item.c fll/level_0/fss/private-named.c fll/level_0/fss/private-nest.c fll/level_0/fss/private-set.c fll/level_0/fss/private-set_quote.c fll/level_0/fss/private-simple_packet.c build_sources_program fll/level_0/iki.c fll/level_0/private-iki.c fll/level_0/iki/common.c fll/level_0/iki/private-data.c fll/level_0/iki/data.c build_sources_program fll/level_0/limit.c fll/level_0/limit/set.c fll/level_0/limit/value.c fll/level_0/limit/private-set.c fll/level_0/limit/private-value.c -build_sources_program fll/level_0/memory.c fll/level_0/memory/array.c +build_sources_program fll/level_0/memory.c fll/level_0/memory/array.c fll/level_0/memory/arrays.c build_sources_program fll/level_0/private-memory.c fll/level_0/memory/private-array.c build_sources_program fll/level_0/parse.c fll/level_0/parse/utf.c build_sources_program fll/level_0/path.c fll/level_0/private-path.c fll/level_0/path/common.c @@ -62,7 +62,6 @@ build_sources_program fll/level_0/utf/common.c fll/level_0/utf/convert.c fll/lev build_sources_program fll/level_0/utf/private-dynamic.c fll/level_0/utf/private-dynamics.c fll/level_0/utf/private-dynamicss.c fll/level_0/utf/private-maps.c fll/level_0/utf/private-mapss.c fll/level_0/utf/private-map_multis.c fll/level_0/utf/private-map_multiss.c fll/level_0/utf/private-string.c fll/level_0/utf/private-triples.c fll/level_0/utf/private-tripless.c build_sources_program-thread fll/level_0/thread.c fll/level_0/thread/attribute.c fll/level_0/thread/barrier.c fll/level_0/thread/barrier_attribute.c fll/level_0/thread/condition.c fll/level_0/thread/condition_attribute.c fll/level_0/thread/id.c fll/level_0/thread/key.c fll/level_0/thread/lock.c fll/level_0/thread/lock_attribute.c fll/level_0/thread/mutex.c fll/level_0/thread/mutex_attribute.c fll/level_0/thread/once.c fll/level_0/thread/semaphore.c fll/level_0/thread/set.c fll/level_0/thread/spin.c -build_sources_program-thread fll/level_0/thread/private-barrier.c fll/level_0/thread/private-barrier_attribute.c fll/level_0/thread/private-condition.c fll/level_0/thread/private-condition_attribute.c build_sources_program fll/level_1/control_group.c build_sources_program fll/level_1/conversion.c fll/level_1/private-conversion.c fll/level_1/conversion/common.c diff --git a/level_0/f_console/tests/unit/c/test-console-parameters_delete.c b/level_0/f_console/tests/unit/c/test-console-parameters_delete.c index 44bfdbe..9578bec 100644 --- a/level_0/f_console/tests/unit/c/test-console-parameters_delete.c +++ b/level_0/f_console/tests/unit/c/test-console-parameters_delete.c @@ -25,7 +25,7 @@ void test__f_console_parameters_delete__frees_memory(void **state) { } { - const f_status_t status = f_number_unsigneds_resize(3, ¶meters.array[0].locations); + const f_status_t status = f_memory_array_resize(size, sizeof(f_number_unsigned_t), (void **) ¶meters.array[0].locations.array, ¶meters.array[0].locations.used, ¶meters.array[0].locations.size); assert_int_equal(status, F_none); assert_int_not_equal(parameters.array[0].locations.size, 0); @@ -33,7 +33,7 @@ void test__f_console_parameters_delete__frees_memory(void **state) { } { - const f_status_t status = f_number_unsigneds_resize(size, ¶meters.array[0].locations_sub); + const f_status_t status = f_memory_array_resize(size, sizeof(f_number_unsigned_t), (void **) ¶meters.array[0].locations_sub.array, ¶meters.array[0].locations_sub.used, ¶meters.array[0].locations_sub.size); assert_int_equal(status, F_none); assert_int_not_equal(parameters.array[0].locations_sub.size, 0); diff --git a/level_0/f_console/tests/unit/c/test-console-parameters_destroy.c b/level_0/f_console/tests/unit/c/test-console-parameters_destroy.c index c79c3d9..7877702 100644 --- a/level_0/f_console/tests/unit/c/test-console-parameters_destroy.c +++ b/level_0/f_console/tests/unit/c/test-console-parameters_destroy.c @@ -25,7 +25,7 @@ void test__f_console_parameters_destroy__frees_memory(void **state) { } { - const f_status_t status = f_number_unsigneds_resize(size, ¶meters.array[0].locations); + const f_status_t status = f_memory_array_resize(size, sizeof(f_number_unsigned_t), (void **) ¶meters.array[0].locations.array, ¶meters.array[0].locations.used, ¶meters.array[0].locations.size); assert_int_equal(status, F_none); assert_int_not_equal(parameters.array[0].locations.size, 0); @@ -33,7 +33,7 @@ void test__f_console_parameters_destroy__frees_memory(void **state) { } { - const f_status_t status = f_number_unsigneds_resize(size, ¶meters.array[0].locations_sub); + const f_status_t status = f_memory_array_resize(size, sizeof(f_number_unsigned_t), (void **) ¶meters.array[0].locations_sub.array, ¶meters.array[0].locations_sub.used, ¶meters.array[0].locations_sub.size); assert_int_equal(status, F_none); assert_int_not_equal(parameters.array[0].locations_sub.size, 0); diff --git a/level_0/f_file/c/file/stream.c b/level_0/f_file/c/file/stream.c index e96c7a7..25b7ce4 100644 --- a/level_0/f_file/c/file/stream.c +++ b/level_0/f_file/c/file/stream.c @@ -282,7 +282,7 @@ extern "C" { funlockfile(file.stream); - return F_none_eof; + return F_none; } #endif // _di_f_file_stream_read_block_ diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_append.c b/level_0/f_iki/tests/unit/c/test-iki-datas_append.c index f518cf4..ab42696 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datas_append.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datas_append.c @@ -19,7 +19,7 @@ void test__f_iki_datas_append__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(source.content.size, length); - status = f_number_unsigneds_resize(length, &source.delimits); + status = f_memory_array_resize(length, sizeof(f_number_unsigned_t), (void **) &source.delimits.array, &source.delimits.used, &source.delimits.size); assert_int_equal(status, F_none); assert_int_equal(source.delimits.size, length); diff --git a/level_0/f_iki/tests/unit/c/test-iki-datas_append_all.c b/level_0/f_iki/tests/unit/c/test-iki-datas_append_all.c index 15336bb..764be62 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datas_append_all.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datas_append_all.c @@ -27,7 +27,7 @@ void test__f_iki_datas_append_all__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(source.array[j].content.size, length); - status = f_number_unsigneds_resize(length, &source.array[j].delimits); + status = f_memory_array_resize(length, sizeof(f_number_unsigned_t), (void **) &source.array[j].delimits.array, &source.array[j].delimits.used, &source.array[j].delimits.size); assert_int_equal(status, F_none); assert_int_equal(source.array[j].delimits.size, length); diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_append.c b/level_0/f_iki/tests/unit/c/test-iki-datass_append.c index bd23970..83def3e 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datass_append.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datass_append.c @@ -27,7 +27,7 @@ void test__f_iki_datass_append__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(source.array[j].content.size, length); - status = f_number_unsigneds_resize(length, &source.array[j].delimits); + status = f_memory_array_resize(length, sizeof(f_number_unsigned_t), (void **) &source.array[j].delimits.array, &source.array[j].delimits.used, &source.array[j].delimits.size); assert_int_equal(status, F_none); assert_int_equal(source.array[j].delimits.size, length); diff --git a/level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c b/level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c index 4b4f405..45f68aa 100644 --- a/level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c +++ b/level_0/f_iki/tests/unit/c/test-iki-datass_append_all.c @@ -36,7 +36,7 @@ void test__f_iki_datass_append_all__works(void **state) { assert_int_equal(status, F_none); assert_int_equal(source.array[source.used].array[j].content.size, length); - status = f_number_unsigneds_resize(length, &source.array[source.used].array[j].delimits); + status = f_memory_array_resize(length, sizeof(f_number_unsigned_t), (void **) &source.array[source.used].array[j].delimits.array, &source.array[source.used].array[j].delimits.used, &source.array[source.used].array[j].delimits.size); assert_int_equal(status, F_none); assert_int_equal(source.array[source.used].array[j].delimits.size, length); diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index e64ebc3..765734e 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -1,8 +1,4 @@ #include "thread.h" -#include "thread/private-barrier.h" -#include "thread/private-barrier_attribute.h" -#include "thread/private-condition.h" -#include "thread/private-condition_attribute.h" #ifdef __cplusplus extern "C" { @@ -493,7 +489,7 @@ extern "C" { if (!attribute) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_barrier_attribute_delete(attribute); + return pthread_barrierattr_destroy(attribute) ? F_status_set_error(F_failure) : F_none; } #endif // _di_f_thread_barrier_attribute_delete_ @@ -561,7 +557,16 @@ extern "C" { if (!barrier) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_barrier_delete(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); + } + + return F_none; } #endif // _di_f_thread_barrier_delete_ @@ -745,7 +750,18 @@ extern "C" { if (!condition_attribute) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_condition_attribute_delete(condition_attribute); + { + const int error = pthread_condattr_destroy(condition_attribute); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } + + return F_none; } #endif // _di_f_thread_condition_attribute_delete_ @@ -813,7 +829,16 @@ extern "C" { if (!condition) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_condition_delete(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 // _di_f_thread_condition_delete_ diff --git a/level_0/f_thread/c/thread/barrier.c b/level_0/f_thread/c/thread/barrier.c index 65bb682..7679950 100644 --- a/level_0/f_thread/c/thread/barrier.c +++ b/level_0/f_thread/c/thread/barrier.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-barrier.h" #include "barrier.h" #ifdef __cplusplus @@ -12,7 +11,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_barriers_adjust(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_barrier_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_barrier_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_barriers_adjust_ @@ -24,7 +39,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_barriers_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_barrier_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_barrier_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_barriers_decimate_by_ @@ -36,7 +69,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_barriers_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_barrier_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_barrier_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_barriers_decrease_by_ @@ -55,7 +106,23 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_barriers_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_barrier_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_barrier_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +143,23 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_barriers_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_barrier_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_barrier_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +173,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_barriers_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_barrier_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_barrier_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_barriers_resize_ diff --git a/level_0/f_thread/c/thread/barrier_attribute.c b/level_0/f_thread/c/thread/barrier_attribute.c index 98f40b5..bed0c32 100644 --- a/level_0/f_thread/c/thread/barrier_attribute.c +++ b/level_0/f_thread/c/thread/barrier_attribute.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-barrier_attribute.h" #include "barrier_attribute.h" #ifdef __cplusplus @@ -12,7 +11,11 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_barrier_attributes_adjust(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_barrierattr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_barrier_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_barrier_attributes_adjust_ @@ -24,7 +27,13 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_barrier_attributes_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_barrierattr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_adjust(length, sizeof(f_thread_barrier_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_barrier_attributes_decimate_by_ @@ -36,7 +45,13 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_barrier_attributes_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_barrierattr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_barrier_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_barrier_attributes_decrease_by_ @@ -55,7 +70,11 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_barrier_attributes_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_barrierattr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_barrier_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +95,11 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_barrier_attributes_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_barrierattr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_barrier_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +113,11 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_barrier_attributes_resize(length, structure); + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + if (pthread_barrierattr_destroy(&structure->array[i])) return F_status_set_error(F_failure); + } // for + + return f_memory_array_resize(length, sizeof(f_thread_barrier_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_barrier_attributes_resize_ diff --git a/level_0/f_thread/c/thread/condition.c b/level_0/f_thread/c/thread/condition.c index 618df12..7fe5170 100644 --- a/level_0/f_thread/c/thread/condition.c +++ b/level_0/f_thread/c/thread/condition.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-condition.h" #include "condition.h" #ifdef __cplusplus @@ -12,7 +11,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_conditions_adjust(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_cond_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_condition_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_conditions_adjust_ @@ -24,7 +39,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_conditions_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_cond_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_condition_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_conditions_decimate_by_ @@ -36,7 +69,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_conditions_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_cond_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_condition_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_conditions_decrease_by_ @@ -55,7 +106,23 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_conditions_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_cond_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_condition_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +143,23 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_conditions_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_cond_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_condition_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +173,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_conditions_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_cond_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_condition_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_conditions_resize_ diff --git a/level_0/f_thread/c/thread/condition_attribute.c b/level_0/f_thread/c/thread/condition_attribute.c index 5d2200a..ebca2de 100644 --- a/level_0/f_thread/c/thread/condition_attribute.c +++ b/level_0/f_thread/c/thread/condition_attribute.c @@ -1,5 +1,4 @@ #include "../thread.h" -#include "private-condition_attribute.h" #include "condition_attribute.h" #ifdef __cplusplus @@ -12,7 +11,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_condition_attributes_adjust(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_condattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_condition_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_condition_attributes_adjust_ @@ -24,7 +39,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_condition_attributes_adjust((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_condattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_adjust(length, sizeof(f_thread_condition_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_condition_attributes_decimate_by_ @@ -36,7 +69,25 @@ extern "C" { if (!amount) return F_data_not; - return private_f_thread_condition_attributes_resize((structure->size > amount) ? structure->size - amount : 0, structure); + const f_number_unsigned_t length = (structure->size > amount) ? structure->size - amount : 0; + + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_condattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_condition_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_condition_attributes_decrease_by_ @@ -55,7 +106,23 @@ extern "C" { length = F_number_t_size_unsigned_d; } - return private_f_thread_condition_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_condattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_condition_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } return F_data_not; @@ -76,7 +143,23 @@ extern "C" { if (length > structure->size) { if (length > F_number_t_size_unsigned_d) return F_status_set_error(F_array_too_large); - return private_f_thread_condition_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_condattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_condition_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } } @@ -90,7 +173,23 @@ extern "C" { if (!structure) return F_status_set_error(F_parameter); #endif // _di_level_0_parameter_checking_ - return private_f_thread_condition_attributes_resize(length, structure); + { + int error = 0; + + for (f_number_unsigned_t i = length; i < structure->size; ++i) { + + error = pthread_condattr_destroy(&structure->array[i]); + + if (error) { + if (error == EBUSY) return F_status_set_error(F_busy); + if (error == EINVAL) return F_status_set_error(F_parameter); + + return F_status_set_error(F_failure); + } + } // for + } + + return f_memory_array_resize(length, sizeof(f_thread_condition_attribute_t), (void **) &structure->array, &structure->used, &structure->size); } #endif // _di_f_thread_condition_attributes_resize_ diff --git a/level_0/f_thread/c/thread/private-barrier.c b/level_0/f_thread/c/thread/private-barrier.c deleted file mode 100644 index b9535e5..0000000 --- a/level_0/f_thread/c/thread/private-barrier.c +++ /dev/null @@ -1,56 +0,0 @@ -#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 *structure) { - - const int error = pthread_barrier_destroy(structure); - - if (error) { - if (error == EBUSY) return F_status_set_error(F_busy); - if (error == EINVAL) return F_status_set_error(F_parameter); - - return F_status_set_error(F_failure); - } - - return F_none; - } -#endif // !defined(_di_f_thread_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 structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_barrier_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_barrier_t), (void **) &structure->array, &structure->used, &structure->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 structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_barrier_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_barrier_t), (void **) &structure->array, &structure->used, &structure->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 deleted file mode 100644 index a0551a0..0000000 --- a/level_0/f_thread/c/thread/private-barrier.h +++ /dev/null @@ -1,102 +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_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 structure - * The barrier to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_attr_destroy() - * - * @see f_thread_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 *structure) 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 structure - * The barriers to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @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 structure) 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 structure - * The barriers to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_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 structure) 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 deleted file mode 100644 index b5182f1..0000000 --- a/level_0/f_thread/c/thread/private-barrier_attribute.c +++ /dev/null @@ -1,49 +0,0 @@ -#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 *structure) { - - if (pthread_barrierattr_destroy(structure)) return F_status_set_error(F_failure); - - 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 deleted file mode 100644 index e56a8cd..0000000 --- a/level_0/f_thread/c/thread/private-barrier_attribute.h +++ /dev/null @@ -1,102 +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_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 structure - * The attribute to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_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 *structure) 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 structure - * The barrier_attributes to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_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 structure) 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 structure - * The barrier_attributes to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_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 structure) 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 deleted file mode 100644 index 36a1aa5..0000000 --- a/level_0/f_thread/c/thread/private-condition.c +++ /dev/null @@ -1,56 +0,0 @@ -#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 structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_condition_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_condition_t), (void **) &structure->array, &structure->used, &structure->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 structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_condition_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_condition_t), (void **) &structure->array, &structure->used, &structure->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 deleted file mode 100644 index e5d9c51..0000000 --- a/level_0/f_thread/c/thread/private-condition.h +++ /dev/null @@ -1,103 +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_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 structure - * 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 *structure) 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 structure - * The conditions to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @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 structure) 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 structure - * The conditions to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_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 structure) 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 deleted file mode 100644 index bc36c33..0000000 --- a/level_0/f_thread/c/thread/private-condition_attribute.c +++ /dev/null @@ -1,56 +0,0 @@ -#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 structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_condition_attribute_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_adjust(length, sizeof(f_thread_condition_attribute_t), (void **) &structure->array, &structure->used, &structure->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 structure) { - - f_status_t status = F_none; - - for (f_number_unsigned_t i = length; i < structure->size; ++i) { - - status = private_f_thread_condition_attribute_delete(&structure->array[i]); - if (F_status_is_error(status)) return status; - } // for - - return f_memory_array_resize(length, sizeof(f_thread_condition_attribute_t), (void **) &structure->array, &structure->used, &structure->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 deleted file mode 100644 index 50e670d..0000000 --- a/level_0/f_thread/c/thread/private-condition_attribute.h +++ /dev/null @@ -1,102 +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_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 structure - * The attribute to delete. - * - * @return - * F_none on success. - * - * F_busy (with error bit) if the lock is busy. - * F_failure (with error bit) on error. - * F_parameter (with error bit) if a parameter is invalid. - * - * @see pthread_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 *structure) 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 structure - * The condition_attributes to adjust. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_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 structure) 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 structure - * The condition_attributes to resize. - * - * @return - * F_none on success. - * - * Errors (with error bit) from: f_memory_array_resize(). - * - * @see f_memory_array_resize() - * - * @see f_thread_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 structure) 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/data/build/settings b/level_0/f_thread/data/build/settings index a88cae1..a2ba253 100644 --- a/level_0/f_thread/data/build/settings +++ b/level_0/f_thread/data/build/settings @@ -35,7 +35,6 @@ build_libraries -lc build_libraries-individual -lf_memory -lf_string build_sources_library thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/condition.c thread/condition_attribute.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/mutex.c thread/mutex_attribute.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c -build_sources_library thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c build_sources_headers thread.h thread/attribute.h thread/barrier.h thread/barrier_attribute.h thread/condition.h thread/condition_attribute.h thread/id.h thread/key.h thread/lock.h thread/lock_attribute.h thread/mutex.h thread/mutex_attribute.h thread/once.h thread/semaphore.h thread/set.h thread/spin.h diff --git a/level_0/f_thread/data/build/settings-mocks b/level_0/f_thread/data/build/settings-mocks index f6703b2..e09a69d 100644 --- a/level_0/f_thread/data/build/settings-mocks +++ b/level_0/f_thread/data/build/settings-mocks @@ -31,7 +31,6 @@ build_libraries -pthread -lc build_libraries-individual -lf_memory -lf_string build_sources_library thread.c thread/attribute.c thread/barrier.c thread/barrier_attribute.c thread/condition.c thread/condition_attribute.c thread/id.c thread/key.c thread/lock.c thread/lock_attribute.c thread/mutex.c thread/mutex_attribute.c thread/once.c thread/semaphore.c thread/set.c thread/spin.c ../../tests/unit/c/mock-thread.c -build_sources_library thread/private-barrier.c thread/private-barrier_attribute.c thread/private-condition.c thread/private-condition_attribute.c build_sources_headers thread.h thread/attribute.h thread/barrier.h thread/barrier_attribute.h thread/condition.h thread/condition_attribute.h thread/id.h thread/key.h thread/lock.h thread/lock_attribute.h thread/mutex.h thread/mutex_attribute.h thread/once.h thread/semaphore.h thread/set.h thread/spin.h diff --git a/level_2/fll_execute/c/execute.c b/level_2/fll_execute/c/execute.c index d77ebde..2c10beb 100644 --- a/level_2/fll_execute/c/execute.c +++ b/level_2/fll_execute/c/execute.c @@ -278,15 +278,11 @@ extern "C" { f_string_t fixed_arguments[arguments.used + 2]; f_string_static_t program_name = f_string_static_t_initialize; - const f_string_t last_slash = (f_string_t) strrchr( - (program.used - ? program.string - : arguments.used && arguments.array[0].used - ? arguments.array[0].string - : 0 - ), - (char) f_path_separator_s.string[0] - ); + const f_string_t last_slash = program.used + ? (f_string_t) strrchr(program.string, (char) f_path_separator_s.string[0]) + : arguments.used && arguments.array[0].used + ? (f_string_t) strrchr(arguments.array[0].string, (char) f_path_separator_s.string[0]) + : 0; if (last_slash) { program_name.used = strnlen((last_slash + 1), F_path_length_max_d); diff --git a/level_3/iki_read/c/main/iki_read.h b/level_3/iki_read/c/main/iki_read.h index 31ce704..d8385d2 100644 --- a/level_3/iki_read/c/main/iki_read.h +++ b/level_3/iki_read/c/main/iki_read.h @@ -47,7 +47,6 @@ #include #include #include -#include // FLL-2 includes. #include