summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--lib/utils/printf.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/utils/printf.c b/lib/utils/printf.c
index 51dfa5b963..117efff42c 100644
--- a/lib/utils/printf.c
+++ b/lib/utils/printf.c
@@ -26,8 +26,6 @@
#include "py/mpconfig.h"
-#if MICROPY_USE_INTERNAL_PRINTF
-
#include <stdint.h>
#include <string.h>
#include <stdarg.h>
@@ -39,6 +37,22 @@
#include "py/formatfloat.h"
#endif
+#if MICROPY_DEBUG_PRINTERS
+int DEBUG_printf(const char *fmt, ...) {
+ va_list ap;
+ va_start(ap, fmt);
+ #ifndef MICROPY_DEBUG_PRINTER_DEST
+ #define MICROPY_DEBUG_PRINTER_DEST mp_plat_print
+ #endif
+ extern const mp_print_t MICROPY_DEBUG_PRINTER_DEST;
+ int ret = mp_vprintf(&MICROPY_DEBUG_PRINTER_DEST, fmt, ap);
+ va_end(ap);
+ return ret;
+}
+#endif
+
+#if MICROPY_USE_INTERNAL_PRINTF
+
#undef putchar // Some stdlibs have a #define for putchar
int printf(const char *fmt, ...);
int vprintf(const char *fmt, va_list ap);
@@ -59,20 +73,6 @@ int vprintf(const char *fmt, va_list ap) {
return mp_vprintf(&mp_plat_print, fmt, ap);
}
-#if MICROPY_DEBUG_PRINTERS
-int DEBUG_printf(const char *fmt, ...) {
- va_list ap;
- va_start(ap, fmt);
- #ifndef MICROPY_DEBUG_PRINTER_DEST
- #define MICROPY_DEBUG_PRINTER_DEST mp_plat_print
- #endif
- extern const mp_print_t MICROPY_DEBUG_PRINTER_DEST;
- int ret = mp_vprintf(&MICROPY_DEBUG_PRINTER_DEST, fmt, ap);
- va_end(ap);
- return ret;
-}
-#endif
-
// need this because gcc optimises printf("%c", c) -> putchar(c), and printf("a") -> putchar('a')
int putchar(int c) {
char chr = c;