From b07acb3cdf38650f29ecd90f160580f94ebe6771 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sun, 19 Apr 2026 20:51:23 +0100 Subject: [PATCH] libc: core: add return-value to printf output callbacks --- lib/libc/core/stdio/printf.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/libc/core/stdio/printf.c b/lib/libc/core/stdio/printf.c index 988c085..5055ec5 100644 --- a/lib/libc/core/stdio/printf.c +++ b/lib/libc/core/stdio/printf.c @@ -118,7 +118,7 @@ #endif // output function type -typedef void ( +typedef int ( *out_fct_type)(char character, void *buffer, size_t idx, size_t maxlen); // wrapper (used as buffer) for output function type @@ -128,7 +128,7 @@ typedef struct { } out_fct_wrap_type; // internal buffer output -static inline void _out_buffer( +static inline int _out_buffer( char character, void *buffer, size_t idx, @@ -137,10 +137,12 @@ static inline void _out_buffer( if (idx < maxlen) { ((char *)buffer)[idx] = character; } + + return 0; } // internal null output -static inline void _out_null( +static inline int _out_null( char character, void *buffer, size_t idx, @@ -150,10 +152,11 @@ static inline void _out_null( (void)buffer; (void)idx; (void)maxlen; + return 0; } // internal output function wrapper -static inline void _out_fct( +static inline int _out_fct( char character, void *buffer, size_t idx, @@ -166,6 +169,8 @@ static inline void _out_fct( ((out_fct_wrap_type *)buffer) ->fct(character, ((out_fct_wrap_type *)buffer)->arg); } + + return 0; } // internal secure strlen