libc: core: add return-value to printf output callbacks
This commit is contained in:
@@ -118,7 +118,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// output function type
|
// output function type
|
||||||
typedef void (
|
typedef int (
|
||||||
*out_fct_type)(char character, void *buffer, size_t idx, size_t maxlen);
|
*out_fct_type)(char character, void *buffer, size_t idx, size_t maxlen);
|
||||||
|
|
||||||
// wrapper (used as buffer) for output function type
|
// wrapper (used as buffer) for output function type
|
||||||
@@ -128,7 +128,7 @@ typedef struct {
|
|||||||
} out_fct_wrap_type;
|
} out_fct_wrap_type;
|
||||||
|
|
||||||
// internal buffer output
|
// internal buffer output
|
||||||
static inline void _out_buffer(
|
static inline int _out_buffer(
|
||||||
char character,
|
char character,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
size_t idx,
|
size_t idx,
|
||||||
@@ -137,10 +137,12 @@ static inline void _out_buffer(
|
|||||||
if (idx < maxlen) {
|
if (idx < maxlen) {
|
||||||
((char *)buffer)[idx] = character;
|
((char *)buffer)[idx] = character;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// internal null output
|
// internal null output
|
||||||
static inline void _out_null(
|
static inline int _out_null(
|
||||||
char character,
|
char character,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
size_t idx,
|
size_t idx,
|
||||||
@@ -150,10 +152,11 @@ static inline void _out_null(
|
|||||||
(void)buffer;
|
(void)buffer;
|
||||||
(void)idx;
|
(void)idx;
|
||||||
(void)maxlen;
|
(void)maxlen;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// internal output function wrapper
|
// internal output function wrapper
|
||||||
static inline void _out_fct(
|
static inline int _out_fct(
|
||||||
char character,
|
char character,
|
||||||
void *buffer,
|
void *buffer,
|
||||||
size_t idx,
|
size_t idx,
|
||||||
@@ -166,6 +169,8 @@ static inline void _out_fct(
|
|||||||
((out_fct_wrap_type *)buffer)
|
((out_fct_wrap_type *)buffer)
|
||||||
->fct(character, ((out_fct_wrap_type *)buffer)->arg);
|
->fct(character, ((out_fct_wrap_type *)buffer)->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// internal secure strlen
|
// internal secure strlen
|
||||||
|
|||||||
Reference in New Issue
Block a user