]> granicus.if.org Git - esp-idf/commitdiff
examples: don't enable buffering on stdout in console examples
authorIvan Grokhotkov <ivan@espressif.com>
Wed, 13 Mar 2019 12:19:55 +0000 (20:19 +0800)
committerIvan Grokhotkov <ivan@espressif.com>
Thu, 20 Jun 2019 08:27:42 +0000 (16:27 +0800)
newlib uses significantly more stack space when printing to an
unbuffered stream. To reduce the amount of stack space required to
use the console, don’t disable buffering. linenoise should support
unbuffered stdout instead.

examples/system/console/main/console_example_main.c
examples/wifi/iperf/main/main.c

index a115c6f9998eea7a937ddbde12fabd49c7495722..2e06afa844a6715cd318cffb6286a3b42074e5e1 100644 (file)
@@ -59,9 +59,8 @@ static void initialize_nvs()
 
 static void initialize_console()
 {
-    /* Disable buffering on stdin and stdout */
+    /* Disable buffering on stdin */
     setvbuf(stdin, NULL, _IONBF, 0);
-    setvbuf(stdout, NULL, _IONBF, 0);
 
     /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
     esp_vfs_dev_uart_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
index ffeeb680b59a3bbd7ebe34aaa1537256d439af2d..bc9ddbcbbbf5582c3766150183dd1cbdc9be0cb4 100644 (file)
@@ -28,9 +28,8 @@
 
 static void initialize_console()
 {
-    /* Disable buffering on stdin and stdout */
+    /* Disable buffering on stdin */
     setvbuf(stdin, NULL, _IONBF, 0);
-    setvbuf(stdout, NULL, _IONBF, 0);
 
     /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
     esp_vfs_dev_uart_set_rx_line_endings(ESP_LINE_ENDINGS_CR);