From 0c5bb1a52b1b300359f0dd4a3edc77b36a5649b4 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 4 Aug 2023 19:36:26 -0500 Subject: [PATCH] Update: Wrap the static inline functions private_inline_f_print_to_error in custom disable macros. As an exception case, wrap the private_inline_f_print_to_error() in _di_private_inline_private_f_print_to_error_ and _di_private_inline_f_print_to_error_ as appropriate. Using a define condition on all of the possible cases would be difficult to manage. An explicit define is simpler and easier in this exceptional case. --- build/stand_alone/fake.config.h | 2 ++ level_0/f_print/c/print/private-to.c | 36 +++++++++++++++++++----------------- level_0/f_print/c/print/to.c | 36 +++++++++++++++++++----------------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/build/stand_alone/fake.config.h b/build/stand_alone/fake.config.h index 4733693..cfa89b6 100644 --- a/build/stand_alone/fake.config.h +++ b/build/stand_alone/fake.config.h @@ -2344,3 +2344,5 @@ //#define _di_f_utf_unicode_string_to_ //#define _di_f_utf_unicode_to_ #define _di_f_utf_width_e_ +#define _di_private_inline_f_print_to_error_ +#define _di_private_inline_private_f_print_to_error_ diff --git a/level_0/f_print/c/print/private-to.c b/level_0/f_print/c/print/private-to.c index 68088f9..b9e4d2e 100644 --- a/level_0/f_print/c/print/private-to.c +++ b/level_0/f_print/c/print/private-to.c @@ -14,23 +14,25 @@ extern "C" { * @return * The appropriate status. */ -static inline f_status_t private_inline_f_print_to_error(void) { - - if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block); - if (errno == EBADF) return F_status_set_error(F_file_descriptor); - if (errno == EDESTADDRREQ) return F_status_set_error(F_socket_not); - if (errno == EDQUOT) return F_status_set_error(F_filesystem_quota_block); - if (errno == EFBIG) return F_status_set_error(F_number_overflow); - if (errno == EFAULT) return F_status_set_error(F_buffer); - if (errno == EINTR) return F_status_set_error(F_interrupt); - if (errno == EINVAL) return F_status_set_error(F_parameter); - if (errno == EIO) return F_status_set_error(F_input_output); - if (errno == EISDIR) return F_status_set_error(F_file_type_directory); - if (errno == ENOSPC) return F_status_set_error(F_space_not); - if (errno == EPIPE) return F_status_set_error(F_pipe); - - return F_status_set_error(F_output); -} + #ifndef _di_private_inline_private_f_print_to_error_ + static inline f_status_t private_inline_f_print_to_error(void) { + + if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block); + if (errno == EBADF) return F_status_set_error(F_file_descriptor); + if (errno == EDESTADDRREQ) return F_status_set_error(F_socket_not); + if (errno == EDQUOT) return F_status_set_error(F_filesystem_quota_block); + if (errno == EFBIG) return F_status_set_error(F_number_overflow); + if (errno == EFAULT) return F_status_set_error(F_buffer); + if (errno == EINTR) return F_status_set_error(F_interrupt); + if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == EIO) return F_status_set_error(F_input_output); + if (errno == EISDIR) return F_status_set_error(F_file_type_directory); + if (errno == ENOSPC) return F_status_set_error(F_space_not); + if (errno == EPIPE) return F_status_set_error(F_pipe); + + return F_status_set_error(F_output); + } +#endif // _di_private_inline_private_f_print_to_error_ #if !defined(_di_f_print_to_) || !defined(_di_f_print_dynamic_to_) || !defined(_di_f_print_dynamic_partial_to_) f_status_t private_f_print_to(const f_string_t string, const f_number_unsigned_t length, const int id) { diff --git a/level_0/f_print/c/print/to.c b/level_0/f_print/c/print/to.c index 084b1a1..4e62a79 100644 --- a/level_0/f_print/c/print/to.c +++ b/level_0/f_print/c/print/to.c @@ -14,23 +14,25 @@ extern "C" { * @return * The appropriate status. */ -static inline f_status_t private_inline_f_print_to_error(void) { - - if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block); - if (errno == EBADF) return F_status_set_error(F_file_descriptor); - if (errno == EDESTADDRREQ) return F_status_set_error(F_socket_not); - if (errno == EDQUOT) return F_status_set_error(F_filesystem_quota_block); - if (errno == EFBIG) return F_status_set_error(F_number_overflow); - if (errno == EFAULT) return F_status_set_error(F_buffer); - if (errno == EINTR) return F_status_set_error(F_interrupt); - if (errno == EINVAL) return F_status_set_error(F_parameter); - if (errno == EIO) return F_status_set_error(F_input_output); - if (errno == EISDIR) return F_status_set_error(F_file_type_directory); - if (errno == ENOSPC) return F_status_set_error(F_space_not); - if (errno == EPIPE) return F_status_set_error(F_pipe); - - return F_status_set_error(F_output); -} + #ifndef _di_private_inline_f_print_to_error_ + static inline f_status_t private_inline_f_print_to_error(void) { + + if (errno == EAGAIN || errno == EWOULDBLOCK) return F_status_set_error(F_block); + if (errno == EBADF) return F_status_set_error(F_file_descriptor); + if (errno == EDESTADDRREQ) return F_status_set_error(F_socket_not); + if (errno == EDQUOT) return F_status_set_error(F_filesystem_quota_block); + if (errno == EFBIG) return F_status_set_error(F_number_overflow); + if (errno == EFAULT) return F_status_set_error(F_buffer); + if (errno == EINTR) return F_status_set_error(F_interrupt); + if (errno == EINVAL) return F_status_set_error(F_parameter); + if (errno == EIO) return F_status_set_error(F_input_output); + if (errno == EISDIR) return F_status_set_error(F_file_type_directory); + if (errno == ENOSPC) return F_status_set_error(F_space_not); + if (errno == EPIPE) return F_status_set_error(F_pipe); + + return F_status_set_error(F_output); + } + #endif // _di_private_inline_f_print_to_error_ #ifndef _di_f_print_to_ f_status_t f_print_to(const f_string_t string, const f_number_unsigned_t length, const f_file_t file) { -- 1.8.3.1