From cd22361881b9fb82693c5ada91b03ad32d3494d9 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 11 Dec 2021 19:14:05 -0600 Subject: [PATCH] Cleanup: Utilize 'void' inside of function declarations. It seems that by adding 'void' (without a parameter variable name) instructs the compiler that this function is not allowed to take arguments. When the parameters are empty such as '()', the compiler simply disable checking what the parameters are. By adding void this results in instructing the compiler to verify that there are no parameters. This increases the code integrity. This change may be a problem for older C compilers. --- level_0/f_capability/c/capability.c | 12 ++++++------ level_0/f_capability/c/capability.h | 6 +++--- level_0/f_environment/c/environment.c | 2 +- level_0/f_environment/c/environment.h | 2 +- level_0/f_pipe/c/pipe.c | 8 ++++---- level_0/f_pipe/c/pipe.h | 8 ++++---- level_0/f_thread/c/thread.c | 4 ++-- level_0/f_thread/c/thread.h | 4 ++-- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/level_0/f_capability/c/capability.c b/level_0/f_capability/c/capability.c index 4b012bf..6257d99 100644 --- a/level_0/f_capability/c/capability.c +++ b/level_0/f_capability/c/capability.c @@ -17,7 +17,7 @@ extern "C" { #endif // _di_f_capability_ambient_get_ #ifndef _di_f_capability_ambient_reset_ - f_status_t f_capability_ambient_reset() { + f_status_t f_capability_ambient_reset(void) { return F_status_set_error(F_implemented_not); } #endif // _di_f_capability_ambient_reset_ @@ -330,7 +330,7 @@ extern "C" { #endif // _di_f_capability_size_ #ifndef _di_f_capability_supported_ - bool f_capability_supported() { + bool f_capability_supported(void) { return F_false; } #endif // _di_f_capability_supported_ @@ -340,7 +340,7 @@ extern "C" { #if defined(_di_libcap_) || defined(_libcap_legacy_only_) #ifndef _di_f_capability_supported_ambient_ - bool f_capability_supported_ambient() { + bool f_capability_supported_ambient(void) { return F_false; } #endif // _di_f_capability_supported_ambient_ @@ -406,7 +406,7 @@ extern "C" { #endif // _di_f_capability_ambient_get_ #ifndef _di_f_capability_ambient_reset_ - f_status_t f_capability_ambient_reset() { + f_status_t f_capability_ambient_reset(void) { if (cap_reset_ambient() == -1) { // The documentation doesn't explicitly describe this for "reset" but it can be implicitly inferred because they say "..all of the setting functions..". @@ -1010,7 +1010,7 @@ extern "C" { #endif // _di_f_capability_size_ #ifndef _di_f_capability_supported_ - bool f_capability_supported() { + bool f_capability_supported(void) { return F_true; } #endif // _di_f_capability_supported_ @@ -1020,7 +1020,7 @@ extern "C" { #if !defined(_di_libcap_) && !defined(_libcap_legacy_only_) #ifndef _di_f_capability_supported_ambient_ - bool f_capability_supported_ambient() { + bool f_capability_supported_ambient(void) { return CAP_AMBIENT_SUPPORTED(); } #endif // _di_f_capability_supported_ambient_ diff --git a/level_0/f_capability/c/capability.h b/level_0/f_capability/c/capability.h index 7755527..f95e575 100644 --- a/level_0/f_capability/c/capability.h +++ b/level_0/f_capability/c/capability.h @@ -87,7 +87,7 @@ extern "C" { * @see cap_reset_ambient() */ #ifndef _di_f_capability_ambient_reset_ - extern f_status_t f_capability_ambient_reset(); + extern f_status_t f_capability_ambient_reset(void); #endif // _di_f_capability_ambient_reset_ /** @@ -869,7 +869,7 @@ extern "C" { * FALSE otherwise. */ #ifndef _di_f_capability_supported_ - extern bool f_capability_supported(); + extern bool f_capability_supported(void); #endif // _di_f_capability_supported_ /** @@ -901,7 +901,7 @@ extern "C" { * @see CAP_AMBIENT_SUPPORTED() */ #ifndef _di_f_capability_supported_ambient_ - extern bool f_capability_supported_ambient(); + extern bool f_capability_supported_ambient(void); #endif // _di_f_capability_supported_ambient_ /** diff --git a/level_0/f_environment/c/environment.c b/level_0/f_environment/c/environment.c index b37e41d..964576b 100644 --- a/level_0/f_environment/c/environment.c +++ b/level_0/f_environment/c/environment.c @@ -6,7 +6,7 @@ extern "C" { #endif #ifndef _di_f_environment_clear_ - f_status_t f_environment_clear() { + f_status_t f_environment_clear(void) { if (!clearenv()) { return F_none; } diff --git a/level_0/f_environment/c/environment.h b/level_0/f_environment/c/environment.h index b0c8ff0..35ad1e0 100644 --- a/level_0/f_environment/c/environment.h +++ b/level_0/f_environment/c/environment.h @@ -37,7 +37,7 @@ extern "C" { * @see clearenv() */ #ifndef _di_f_environment_clear_ - extern f_status_t f_environment_clear(); + extern f_status_t f_environment_clear(void); #endif // _di_f_environment_clear_ /** diff --git a/level_0/f_pipe/c/pipe.c b/level_0/f_pipe/c/pipe.c index 6ffc14d..dba59d9 100644 --- a/level_0/f_pipe/c/pipe.c +++ b/level_0/f_pipe/c/pipe.c @@ -5,7 +5,7 @@ extern "C" { #endif #ifndef _di_f_pipe_input_exists_ - f_status_t f_pipe_input_exists() { + f_status_t f_pipe_input_exists(void) { struct stat st_info; if (fstat(F_type_descriptor_input_d, &st_info) != 0) { @@ -21,7 +21,7 @@ extern "C" { #endif // _di_f_pipe_input_exists_ #ifndef _di_f_pipe_warning_exists_ - f_status_t f_pipe_warning_exists() { + f_status_t f_pipe_warning_exists(void) { struct stat st_info; if (fstat(F_type_descriptor_warning_d, &st_info) != 0) { @@ -37,7 +37,7 @@ extern "C" { #endif // _di_f_pipe_warning_exists_ #ifndef _di_f_pipe_error_exists_ - f_status_t f_pipe_error_exists() { + f_status_t f_pipe_error_exists(void) { struct stat st_info; if (fstat(F_type_descriptor_error_d, &st_info) != 0) { @@ -53,7 +53,7 @@ extern "C" { #endif // _di_f_pipe_error_exists_ #ifndef _di_f_pipe_debug_exists_ - f_status_t f_pipe_debug_exists() { + f_status_t f_pipe_debug_exists(void) { struct stat st_info; if (fstat(F_type_descriptor_debug_d, &st_info) != 0) { diff --git a/level_0/f_pipe/c/pipe.h b/level_0/f_pipe/c/pipe.h index f930f08..49f5e32 100644 --- a/level_0/f_pipe/c/pipe.h +++ b/level_0/f_pipe/c/pipe.h @@ -35,7 +35,7 @@ extern "C" { * @see fstat() */ #ifndef _di_f_pipe_input_exists_ - extern f_status_t f_pipe_input_exists(); + extern f_status_t f_pipe_input_exists(void); #endif // _di_f_pipe_input_exists_ /** @@ -52,7 +52,7 @@ extern "C" { * @see fstat() */ #ifndef _di_f_pipe_warning_exists_ - extern f_status_t f_pipe_warning_exists(); + extern f_status_t f_pipe_warning_exists(void); #endif // _di_f_pipe_warning_exists_ /** @@ -67,7 +67,7 @@ extern "C" { * @see fstat() */ #ifndef _di_f_pipe_error_exists_ - extern f_status_t f_pipe_error_exists(); + extern f_status_t f_pipe_error_exists(void); #endif // _di_f_pipe_error_exists_ /** @@ -84,7 +84,7 @@ extern "C" { * @see fstat() */ #ifndef _di_f_pipe_debug_exists_ - extern f_status_t f_pipe_debug_exists(); + extern f_status_t f_pipe_debug_exists(void); #endif // _di_f_pipe_debug_exists_ #ifdef __cplusplus diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index aaa4c34..1f301fe 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -878,7 +878,7 @@ extern "C" { #endif // _di_f_thread_barriers_resize_ #ifndef _di_f_thread_caller_ - f_thread_id_t f_thread_caller() { + f_thread_id_t f_thread_caller(void) { return pthread_self(); } #endif // _di_f_thread_caller_ @@ -924,7 +924,7 @@ extern "C" { #endif // _di_f_thread_cancel_state_set_ #ifndef _di_f_thread_cancel_test_ - f_status_t f_thread_cancel_test() { + f_status_t f_thread_cancel_test(void) { pthread_testcancel(); diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index 134ded6..ecf88bf 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -1162,7 +1162,7 @@ extern "C" { * @see pthread_self() */ #ifndef _di_f_thread_caller_ - extern f_thread_id_t f_thread_caller(); + extern f_thread_id_t f_thread_caller(void); #endif // _di_f_thread_caller_ /** @@ -1218,7 +1218,7 @@ extern "C" { * @see pthread_testcancel() */ #ifndef _di_f_thread_cancel_test_ - extern f_status_t f_thread_cancel_test(); + extern f_status_t f_thread_cancel_test(void); #endif // _di_f_thread_cancel_test_ /** -- 1.8.3.1