summaryrefslogtreecommitdiffstatshomepage
path: root/lib/utils/printf.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-11-22 00:44:22 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-11-22 00:44:41 +0200
commitc3280d83e70b531193b1577f0160559d607d922e (patch)
treee78b3414b578635d41659dcffbfc60a682c096c4 /lib/utils/printf.c
parentede1f547e72c89125b78d3fb1cf5dd7d9c68ec92 (diff)
downloadmicropython-c3280d83e70b531193b1577f0160559d607d922e.tar.gz
micropython-c3280d83e70b531193b1577f0160559d607d922e.zip
unix: Use printf() implementation in terms of mp_printf().
In other words, unix port now uses overriden printf(), instead of using libc's. This should remove almost all dependency on libc stdio (which is bloated).
Diffstat (limited to 'lib/utils/printf.c')
-rw-r--r--lib/utils/printf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/utils/printf.c b/lib/utils/printf.c
index 082b1c65a8..6dce896941 100644
--- a/lib/utils/printf.c
+++ b/lib/utils/printf.c
@@ -51,7 +51,14 @@ int vprintf(const char *fmt, va_list ap) {
int DEBUG_printf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
+ #if MICROPY_DEBUG_STDERR
+ // Printing debug to stderr may give a chance tests which
+ // check stdout to pass, etc.
+ extern const mp_print_t mp_stderr_print;
+ int ret = mp_vprintf(&mp_stderr_print, fmt, ap);
+ #else
int ret = mp_vprintf(&mp_plat_print, fmt, ap);
+ #endif
va_end(ap);
return ret;
}