libc: core: add return-value to printf output callbacks
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user