[PATCH v2 11/16] stdio: puts and putchar static inline wrappers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add static inline wrappers for puts and putchar. This allows the usage
of puts and putchar within the PBL even if the PBL_CONSOLE is disabled.

Signed-off-by: Rouven Czerwinski <r.czerwinski@xxxxxxxxxxxxxx>
---
 include/stdio.h | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/stdio.h b/include/stdio.h
index 7b2a42b..46e2778 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -71,23 +71,32 @@ static inline int ctrlc (void)
 #if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
 	(defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
 int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
+
+static inline int puts(const char *s)
+{
+	return console_puts(CONSOLE_STDOUT, s);
+}
+
+static inline void putchar(char c)
+{
+	console_putc(CONSOLE_STDOUT, c);
+}
 #else
 static int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2)));
 static inline int printf(const char *fmt, ...)
 {
 	return 0;
 }
-#endif
-
 static inline int puts(const char *s)
 {
-	return console_puts(CONSOLE_STDOUT, s);
+	return 0;
 }
 
 static inline void putchar(char c)
 {
-	console_putc(CONSOLE_STDOUT, c);
+	return;
 }
+#endif
 
 /*
  * FILE based functions
-- 
git-series 0.9.1

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux