[PATCH 02/12] include: common.h: move ctrlc() functions into stdio.h

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Oct 14 04:50:30 PDT 2024


A stub definition for ctrlc() is already in stdio.h and stdio.h is
already included by common.h, so let's move all other ctrlc related
definitions into stdio.h.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/common.h | 10 ----------
 include/stdio.h  | 11 +++++++++++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/include/common.h b/include/common.h
index cc7f089aeef0..6baab254c80e 100644
--- a/include/common.h
+++ b/include/common.h
@@ -53,16 +53,6 @@ int	readline	(const char *prompt, char *buf, int len);
 /* common/memsize.c */
 long	get_ram_size  (volatile long *, long);
 
-/* common/console.c */
-int ctrlc(void);
-int arch_ctrlc(void);
-
-#ifdef CONFIG_CONSOLE_FULL
-void ctrlc_handled(void);
-#else
-static inline void ctrlc_handled(void) { }
-#endif
-
 int parse_area_spec(const char *str, loff_t *start, loff_t *size);
 
 /* Just like simple_strtoul(), but this one honors a K/M/G suffix */
diff --git a/include/stdio.h b/include/stdio.h
index 095e9b0a1d42..33ca73a80d18 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -24,6 +24,10 @@ int vasprintf(char **strp, const char *fmt, va_list ap);
 int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
 int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
 
+#ifdef CONFIG_ARCH_HAS_CTRLC
+int arch_ctrlc(void);
+#endif
+
 #ifndef CONFIG_CONSOLE_NONE
 /* stdin */
 int tstc(void);
@@ -35,6 +39,9 @@ int console_puts(unsigned int ch, const char *s);
 void console_flush(void);
 
 int vprintf(const char *fmt, va_list args);
+
+int ctrlc(void);
+void ctrlc_handled(void);
 #else
 static inline int tstc(void)
 {
@@ -66,6 +73,10 @@ static inline int ctrlc (void)
 	return 0;
 }
 
+static inline void ctrlc_handled(void)
+{
+}
+
 #endif
 
 #if (!defined(__PBL__) && !defined(CONFIG_CONSOLE_NONE)) || \
-- 
2.39.5




More information about the barebox mailing list