From 302643990075f41a44b2f657ef0a7984d19b6a62 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 20 Feb 2024 17:45:59 -0600 Subject: [PATCH] Bugfix: Disable defines used for private_f_memory_adjust() and private_f_memory_resize() are incomplete. There are additional functions that call these private functions that require additional disable defines added. The _f_memory_FORCE_secure_memory_ and _f_memory_FORCE_fast_memory_ should be paired with their appropriate _di_f_memory_resize_ and _di_f_memory_adjust_ disable macro. --- level_0/f_memory/c/private-memory.c | 8 ++++---- level_0/f_memory/c/private-memory.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/level_0/f_memory/c/private-memory.c b/level_0/f_memory/c/private-memory.c index 039fda1..0afbd43 100644 --- a/level_0/f_memory/c/private-memory.c +++ b/level_0/f_memory/c/private-memory.c @@ -5,7 +5,7 @@ extern "C" { #endif -#if !defined(_di_f_memory_adjust_) || defined(_f_memory_FORCE_secure_memory_) +#if !defined(_di_f_memory_adjust_) || defined(_f_memory_FORCE_secure_memory_) && !defined(_di_f_memory_resize_) || !defined(_di_f_memory_array_adjust_) || !defined(_di_f_memory_array_decimate_by_) f_status_t private_f_memory_adjust(const size_t length_old, const size_t length_new, const size_t type_size, void ** const pointer) { // When old length is 0 and the pointer is not NULL, then consider this pointer stale and reset it to NULL. @@ -66,9 +66,9 @@ extern "C" { return F_status_set_error(F_memory_not); } -#endif // !defined(_di_f_memory_adjust_) || defined(_f_memory_FORCE_secure_memory_) +#endif // !defined(_di_f_memory_adjust_) || defined(_f_memory_FORCE_secure_memory_) && !defined(_di_f_memory_resize_) || !defined(_di_f_memory_array_adjust_) || !defined(_di_f_memory_array_decimate_by_) -#if !defined(_di_f_memory_resize_) || defined(_f_memory_FORCE_fast_memory_) +#if !defined(_di_f_memory_resize_) || defined(_f_memory_FORCE_fast_memory_) && !defined(_di_f_memory_adjust_) || !defined(_di_f_memory_array_append_) || !defined(_di_f_memory_array_append_all_) || !defined(_di_f_memory_array_decrease_by_) || !defined(_di_f_memory_array_increase_) || !defined(_di_f_memory_array_increase_by_) || !defined(_di_f_memory_array_resize_) f_status_t private_f_memory_resize(const size_t length_old, const size_t length_new, const size_t type_size, void ** const pointer) { // When old length is 0 and the pointer is not NULL, then consider this pointer stale and reset it to NULL. @@ -118,7 +118,7 @@ extern "C" { return F_status_set_error(F_memory_not); } -#endif // !!defined(_di_f_memory_resize_) || defined(_f_memory_FORCE_fast_memory_) +#endif // !defined(_di_f_memory_resize_) || defined(_f_memory_FORCE_fast_memory_) && !defined(_di_f_memory_adjust_) || !defined(_di_f_memory_array_append_) || !defined(_di_f_memory_array_append_all_) || !defined(_di_f_memory_array_decrease_by_) || !defined(_di_f_memory_array_increase_) || !defined(_di_f_memory_array_increase_by_) || !defined(_di_f_memory_array_resize_) #ifdef __cplusplus } // extern "C" diff --git a/level_0/f_memory/c/private-memory.h b/level_0/f_memory/c/private-memory.h index 7da3d68..509b705 100644 --- a/level_0/f_memory/c/private-memory.h +++ b/level_0/f_memory/c/private-memory.h @@ -44,9 +44,9 @@ extern "C" { * @see f_memory_adjust() * @see f_memory_resize() */ -#if !defined(_di_f_memory_adjust_) || defined(_f_memory_FORCE_secure_memory_) +#if !defined(_di_f_memory_adjust_) || defined(_f_memory_FORCE_secure_memory_) && !defined(_di_f_memory_resize_) || !defined(_di_f_memory_array_adjust_) || !defined(_di_f_memory_array_decimate_by_) extern f_status_t private_f_memory_adjust(const size_t length_old, const size_t length_new, const size_t type_size, void ** const pointer) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_memory_adjust_) || defined(_f_memory_FORCE_secure_memory_) +#endif // !defined(_di_f_memory_adjust_) || defined(_f_memory_FORCE_secure_memory_) && !defined(_di_f_memory_resize_) || !defined(_di_f_memory_array_adjust_) || !defined(_di_f_memory_array_decimate_by_) /** * Private implementation for resizing. @@ -77,9 +77,9 @@ extern "C" { * @see f_memory_adjust() * @see f_memory_resize() */ -#if !defined(_di_f_memory_resize_) || defined(_f_memory_FORCE_fast_memory_) +#if !defined(_di_f_memory_resize_) || defined(_f_memory_FORCE_fast_memory_) && !defined(_di_f_memory_adjust_) || !defined(_di_f_memory_array_append_) || !defined(_di_f_memory_array_append_all_) || !defined(_di_f_memory_array_decrease_by_) || !defined(_di_f_memory_array_increase_) || !defined(_di_f_memory_array_increase_by_) || !defined(_di_f_memory_array_resize_) extern f_status_t private_f_memory_resize(const size_t length_old, const size_t length_new, const size_t type_size, void ** const pointer) F_attribute_visibility_internal_d; -#endif // !defined(_di_f_memory_resize_) || defined(_f_memory_FORCE_fast_memory_) +#endif // !defined(_di_f_memory_resize_) || defined(_f_memory_FORCE_fast_memory_) && !defined(_di_f_memory_adjust_) || !defined(_di_f_memory_array_append_) || !defined(_di_f_memory_array_append_all_) || !defined(_di_f_memory_array_decrease_by_) || !defined(_di_f_memory_array_increase_) || !defined(_di_f_memory_array_increase_by_) || !defined(_di_f_memory_array_resize_) #ifdef __cplusplus } // extern "C" -- 1.8.3.1