The function fll_program_standard_signal_received() is being called by fll_program_standard_signal_state().
This is not supposed to be allowed and breaks the functional-modular design.
A private function now exists that is called.
build_sources_library iki.c private-iki.c
build_sources_library path.c
build_sources_library print.c
-build_sources_library program.c program/common.c
+build_sources_library program.c program/common.c private-program.c
build_sources_library status_string.c
build_sources_headers control_group.h
build_sources_library level_2/iki.c level_2/private-iki.c
build_sources_library level_2/path.c
build_sources_library level_2/print.c
-build_sources_library level_2/program.c level_2/program/common.c
+build_sources_library level_2/program.c level_2/program/common.c level_2/private-program.c
build_sources_library level_2/status_string.c
build_sources_library-monolithic level_0/thread.c level_0/private-thread.c level_0/thread/attribute.c level_0/thread/barrier.c level_0/thread/barrier_attribute.c level_0/thread/condition.c level_0/thread/condition_attribute.c level_0/thread/id.c level_0/thread/key.c level_0/thread/lock.c level_0/thread/lock_attribute.c level_0/thread/mutex.c level_0/thread/mutex_attribute.c level_0/thread/once.c level_0/thread/semaphore.c level_0/thread/set.c level_0/thread/spin.c
--- /dev/null
+#include "program.h"
+#include "private-program.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_)
+ f_status_t private_fll_program_standard_signal_received(fll_program_data_t * const main) {
+
+ if (main->signal.id == -1) return 0;
+
+ struct signalfd_siginfo information;
+
+ memset(&information, 0, sizeof(struct signalfd_siginfo));
+
+ if (f_signal_read(main->signal, 0, &information) == F_signal) {
+ switch (information.ssi_signo) {
+ case F_signal_abort:
+ case F_signal_broken_pipe:
+ case F_signal_hangup:
+ case F_signal_interrupt:
+ case F_signal_quit:
+ case F_signal_termination:
+ main->signal_received = information.ssi_signo;
+
+ return information.ssi_signo;
+ }
+ }
+
+ return 0;
+ }
+#endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
--- /dev/null
+/**
+ * FLL - Level 2
+ *
+ * Project: Program
+ * API Version: 0.6
+ * 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_FLL_program_h
+#define _PRIVATE_FLL_program_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Private implementation of fll_program_standard_signal_received().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param main
+ * The main program data.
+ *
+ * @return
+ * A positive number representing a valid signal on signal received.
+ * 0 on no signal received or when main is NULL.
+ *
+ * @see f_signal_read()
+ *
+ * @see fll_program_standard_signal_received()
+ * @see fll_program_standard_signal_state()
+ */
+#if !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_)
+ f_status_t private_fll_program_standard_signal_received(fll_program_data_t * const main) F_attribute_visibility_internal_d;
+#endif // !defined(_di_fll_program_standard_signal_received_) || !defined(_di_fll_program_standard_signal_state_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_FLL_program_h
#include "program.h"
+#include "private-program.h"
#ifdef __cplusplus
extern "C" {
#ifndef _di_fll_program_standard_signal_received_
f_status_t fll_program_standard_signal_received(fll_program_data_t * const main) {
- if (!main || main->signal.id == -1) {
- return F_false;
- }
-
- struct signalfd_siginfo information;
-
- memset(&information, 0, sizeof(struct signalfd_siginfo));
+ if (!main) return 0;
- if (f_signal_read(main->signal, 0, &information) == F_signal) {
- switch (information.ssi_signo) {
- case F_signal_abort:
- case F_signal_broken_pipe:
- case F_signal_hangup:
- case F_signal_interrupt:
- case F_signal_quit:
- case F_signal_termination:
- main->signal_received = information.ssi_signo;
-
- return information.ssi_signo;
- }
- }
-
- return F_false;
+ return private_fll_program_standard_signal_received(main);
}
#endif // _di_fss_basic_read_signal_received_
#ifndef _di_fll_program_standard_signal_state_
f_status_t fll_program_standard_signal_state(void * const state, void * const internal) {
- if (!state) {
- return F_interrupt_not;
- }
+ if (!state) return F_interrupt_not;
f_state_t *state_ptr = (f_state_t *) state;
- if (!state_ptr->custom) {
- return F_interrupt_not;
- }
+ if (!state_ptr->custom) return F_interrupt_not;
fll_program_data_t *custom = (fll_program_data_t *) state_ptr->custom;
- custom->signal_received = fll_program_standard_signal_received(custom);
+ custom->signal_received = private_fll_program_standard_signal_received(custom);
if (custom->signal_received == F_signal_abort || custom->signal_received == F_signal_broken_pipe || custom->signal_received == F_signal_hangup || custom->signal_received == F_signal_interrupt || custom->signal_received == F_signal_quit || custom->signal_received == F_signal_termination) {
return F_status_set_error(F_interrupt);
*
* @return
* A positive number representing a valid signal on signal received.
- * F_false on no signal received or when main is NULL.
+ * 0 on no signal received or when main is NULL.
*
* @see f_signal_read()
*/
build_libraries -lc
build_libraries-individual -lfl_print -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_print -lf_signal -lf_string -lf_type_array -lf_utf
-build_sources_library program.c program/common.c
+build_sources_library program.c program/common.c private-program.c
build_sources_headers program.h program/common.h