kernel: remove printf() (but keep other string formatters)

This commit is contained in:
2023-02-03 20:23:36 +00:00
parent 453ccd4596
commit dba6269fcb
2 changed files with 0 additions and 58 deletions

View File

@@ -147,16 +147,6 @@ static inline void _out_null(char character, void* buffer, size_t idx, size_t ma
} }
// internal _putchar wrapper
static inline void _out_char(char character, void* buffer, size_t idx, size_t maxlen)
{
(void)buffer; (void)idx; (void)maxlen;
if (character) {
console_putchar(character);
}
}
// internal output function wrapper // internal output function wrapper
static inline void _out_fct(char character, void* buffer, size_t idx, size_t maxlen) static inline void _out_fct(char character, void* buffer, size_t idx, size_t maxlen)
{ {
@@ -861,17 +851,6 @@ static int _vsnprintf(out_fct_type out, char* buffer, const size_t maxlen, const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int printf_(const char* format, ...)
{
va_list va;
va_start(va, format);
char buffer[1];
const int ret = _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
va_end(va);
return ret;
}
int sprintf_(char* buffer, const char* format, ...) int sprintf_(char* buffer, const char* format, ...)
{ {
va_list va; va_list va;
@@ -892,13 +871,6 @@ int snprintf_(char* buffer, size_t count, const char* format, ...)
} }
int vprintf_(const char* format, va_list va)
{
char buffer[1];
return _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
}
int vsnprintf_(char* buffer, size_t count, const char* format, va_list va) int vsnprintf_(char* buffer, size_t count, const char* format, va_list va)
{ {
return _vsnprintf(_out_buffer, buffer, count, format, va); return _vsnprintf(_out_buffer, buffer, count, format, va);

View File

@@ -41,26 +41,6 @@ extern "C" {
#endif #endif
/**
* Output a character to a custom device like UART, used by the printf() function
* This function is declared here only. You have to write your custom implementation somewhere
* \param character Character to output
*/
void _putchar(char character);
/**
* Tiny printf implementation
* You have to implement _putchar if you use printf()
* To avoid conflicts with the regular printf() API it is overridden by macro defines
* and internal underscore-appended functions like printf_() are used
* \param format A string that specifies the format of the output
* \return The number of characters that are written into the array, not counting the terminating null character
*/
#define printf printf_
int printf_(const char* format, ...);
/** /**
* Tiny sprintf implementation * Tiny sprintf implementation
* Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD! * Due to security reasons (buffer overflow) YOU SHOULD CONSIDER USING (V)SNPRINTF INSTEAD!
@@ -88,16 +68,6 @@ int snprintf_(char* buffer, size_t count, const char* format, ...);
int vsnprintf_(char* buffer, size_t count, const char* format, va_list va); int vsnprintf_(char* buffer, size_t count, const char* format, va_list va);
/**
* Tiny vprintf implementation
* \param format A string that specifies the format of the output
* \param va A value identifying a variable arguments list
* \return The number of characters that are WRITTEN into the buffer, not counting the terminating null character
*/
#define vprintf vprintf_
int vprintf_(const char* format, va_list va);
/** /**
* printf with output function * printf with output function
* You may use this as dynamic alternative to printf() with its fixed _putchar() output * You may use this as dynamic alternative to printf() with its fixed _putchar() output