1
0
Fork 0

refactor(printf): changed oprintf() to fctprintf()

fctprintf() is more descriptive for its operation
development v2.4.0
Marco Paland 7 years ago
parent 9351e5b1ac
commit 0116b74916

@ -51,8 +51,8 @@ int sprintf(char* buffer, const char* format, ...);
int snprintf(char* buffer, size_t count, const char* format, ...); 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);
// write to output function (instead of buffer) // call output function (instead of buffer)
int oprintf(void (*out)(char character), const char* format, ...); int fctprintf(void (*out)(char character), const char* format, ...);
``` ```

@ -691,7 +691,7 @@ int vsnprintf(char* buffer, size_t count, const char* format, va_list va)
} }
int oprintf(void (*out)(char character), const char* format, ...) int fctprintf(void (*out)(char character), const char* format, ...)
{ {
va_list va; va_list va;
va_start(va, format); va_start(va, format);

@ -87,7 +87,7 @@ int vsnprintf(char* buffer, size_t count, const char* format, va_list va);
* \param format A string that specifies the format of the output * \param format A string that specifies the format of the output
* \return The number of characters that are sent to the output function, not counting the terminating null character * \return The number of characters that are sent to the output function, not counting the terminating null character
*/ */
int oprintf(void (*out)(char character), const char* format, ...); int fctprintf(void (*out)(char character), const char* format, ...);
#ifdef __cplusplus #ifdef __cplusplus

@ -57,10 +57,10 @@ TEST_CASE("printf", "[]" ) {
} }
TEST_CASE("oprintf", "[]" ) { TEST_CASE("fctprintf", "[]" ) {
printf_idx = 0U; printf_idx = 0U;
memset(printf_buffer, 0xCC, 100U); memset(printf_buffer, 0xCC, 100U);
test::oprintf(&test::_putchar, "This is a test of %X", 0x12EFU); test::fctprintf(&test::_putchar, "This is a test of %X", 0x12EFU);
REQUIRE(!strcmp(printf_buffer, "This is a test of 12EF")); REQUIRE(!strcmp(printf_buffer, "This is a test of 12EF"));
} }

Loading…
Cancel
Save