Skip to content

Commit d9e9e9a

Browse files
committed
removed MBED_PRINT_CHARACTER to simplify logic arounf fputc
1 parent c6625fd commit d9e9e9a

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

TESTS/mbed_platform/minimal-printf/compliance/mbed_printf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int mbed_printf(const char *format, ...)
2323
{
2424
va_list arguments;
2525
va_start(arguments, format);
26-
int result = mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, NULL);
26+
int result = mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, stdout);
2727
va_end(arguments);
2828

2929
return result;
@@ -41,7 +41,7 @@ int mbed_snprintf(char *buffer, size_t length, const char *format, ...)
4141

4242
int mbed_vprintf(const char *format, va_list arguments)
4343
{
44-
return mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, NULL);
44+
return mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, stdout);
4545
}
4646

4747
int mbed_vsnprintf(char *buffer, size_t length, const char *format, va_list arguments)

platform/source/minimal-printf/mbed_printf_implementation.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
static char mbed_stdio_out_prev = 0;
3131
#endif
3232

33-
#define MBED_PRINT_CHARACTER(x) { fputc(x, stdout); }
34-
3533

3634
/***************************/
3735
/* Linux */
@@ -41,7 +39,6 @@ static char mbed_stdio_out_prev = 0;
4139
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT 1
4240
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_SET_FLOATING_POINT_MAX_DECIMALS 6
4341
#define MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_64_BIT 1
44-
#define MBED_PRINT_CHARACTER(x) { printf("%c", x); }
4542
#endif
4643

4744
#ifndef MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT
@@ -129,13 +126,9 @@ static void mbed_minimal_putchar(char *buffer, size_t length, int *result, char
129126
if (buffer) {
130127
buffer[*result] = data;
131128
} else {
132-
#if MBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FILE_STREAM
129+
/* print character to stdout or file */
133130
if (stream) {
134-
fputc(data, (FILE *) stream);
135-
} else
136-
#endif
137-
{
138-
MBED_PRINT_CHARACTER(data);
131+
fputc(data, stream);
139132
}
140133
}
141134
}

platform/source/minimal-printf/mbed_printf_wrapper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int SUB_PRINTF(const char *format, ...)
6868
{
6969
va_list arguments;
7070
va_start(arguments, format);
71-
int result = mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, NULL);
71+
int result = mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, stdout);
7272
va_end(arguments);
7373

7474
return result;
@@ -96,7 +96,7 @@ int SUB_SNPRINTF(char *buffer, size_t length, const char *format, ...)
9696

9797
int SUB_VPRINTF(const char *format, va_list arguments)
9898
{
99-
return mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, NULL);
99+
return mbed_minimal_formatted_string(NULL, LONG_MAX, format, arguments, stdout);
100100
}
101101

102102
int SUB_VSPRINTF(char *buffer, const char *format, va_list arguments)

0 commit comments

Comments
 (0)