This is an automated email from the ASF dual-hosted git repository.

jiuzhudong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 84dc88730cd27ec7ab8ce7cefac89e3763dfd2d5
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Mon Jun 9 14:39:03 2025 +0800

    libc: Move stream printf/scanf from libc/stdio to libc/stream
    
    to keep all related code in one place
    
    Signed-off-by: Xiang Xiao <xiaoxi...@xiaomi.com>
---
 libs/libc/stdio/CMakeLists.txt                 | 11 +----------
 libs/libc/stdio/Make.defs                      | 13 ++++---------
 libs/libc/stream/CMakeLists.txt                | 11 ++++++++++-
 libs/libc/stream/Make.defs                     |  7 ++++++-
 libs/libc/{stdio => stream}/lib_dtoa_data.c    |  2 +-
 libs/libc/{stdio => stream}/lib_dtoa_engine.c  |  2 +-
 libs/libc/{stdio => stream}/lib_dtoa_engine.h  |  8 ++++----
 libs/libc/{stdio => stream}/lib_libbsprintf.c  |  2 +-
 libs/libc/{stdio => stream}/lib_libsprintf.c   |  2 +-
 libs/libc/{stdio => stream}/lib_libvscanf.c    |  2 +-
 libs/libc/{stdio => stream}/lib_libvsprintf.c  |  2 +-
 libs/libc/{stdio => stream}/lib_ultoa_invert.c |  2 +-
 libs/libc/{stdio => stream}/lib_ultoa_invert.h |  8 ++++----
 13 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/libs/libc/stdio/CMakeLists.txt b/libs/libc/stdio/CMakeLists.txt
index cb88cce98d..a41cff00ef 100644
--- a/libs/libc/stdio/CMakeLists.txt
+++ b/libs/libc/stdio/CMakeLists.txt
@@ -28,7 +28,6 @@ set(SRCS
     lib_sprintf.c
     lib_asprintf.c
     lib_snprintf.c
-    lib_libsprintf.c
     lib_vsprintf.c
     lib_vasprintf.c
     lib_vsnprintf.c
@@ -44,19 +43,11 @@ set(SRCS
     lib_libdgets.c
     lib_sscanf.c
     lib_vsscanf.c
-    lib_libvscanf.c
-    lib_libvsprintf.c
     lib_remove.c
     lib_tempnam.c
     lib_tmpnam.c
-    lib_ultoa_invert.c
     lib_renameat.c
-    lib_putwchar.c
-    lib_libbsprintf.c)
-
-if(CONFIG_LIBC_FLOATINGPOINT)
-  list(APPEND SRCS lib_dtoa_engine.c lib_dtoa_data.c)
-endif()
+    lib_putwchar.c)
 
 # The remaining sources files depend upon C streams
 
diff --git a/libs/libc/stdio/Make.defs b/libs/libc/stdio/Make.defs
index 5f61a8f243..218d494879 100644
--- a/libs/libc/stdio/Make.defs
+++ b/libs/libc/stdio/Make.defs
@@ -24,17 +24,12 @@
 # This first group of C files do not depend on having C streams.
 
 CSRCS += lib_fileno.c lib_printf.c lib_sprintf.c lib_asprintf.c
-CSRCS += lib_snprintf.c lib_libsprintf.c lib_vsprintf.c lib_vasprintf.c
+CSRCS += lib_snprintf.c lib_vsprintf.c lib_vasprintf.c
 CSRCS += lib_vsnprintf.c lib_dprintf.c lib_vdprintf.c lib_vprintf.c
 CSRCS += lib_perror.c lib_putchar.c lib_getchar.c lib_puts.c
-CSRCS += lib_gets_s.c lib_gets.c lib_libdgets.c
-CSRCS += lib_sscanf.c lib_vsscanf.c lib_libvscanf.c lib_libvsprintf.c
-CSRCS += lib_remove.c lib_tempnam.c lib_tmpnam.c lib_ultoa_invert.c
-CSRCS += lib_renameat.c lib_putwchar.c lib_libbsprintf.c
-
-ifeq ($(CONFIG_LIBC_FLOATINGPOINT),y)
-CSRCS += lib_dtoa_engine.c lib_dtoa_data.c
-endif
+CSRCS += lib_gets_s.c lib_gets.c lib_libdgets.c lib_sscanf.c
+CSRCS += lib_vsscanf.c lib_remove.c lib_tempnam.c lib_tmpnam.c
+CSRCS += lib_renameat.c lib_putwchar.c
 
 # The remaining sources files depend upon C streams
 
diff --git a/libs/libc/stream/CMakeLists.txt b/libs/libc/stream/CMakeLists.txt
index 043c4989dd..8a9be76ea5 100644
--- a/libs/libc/stream/CMakeLists.txt
+++ b/libs/libc/stream/CMakeLists.txt
@@ -44,7 +44,16 @@ list(
   lib_hexdumpstream.c
   lib_base64outstream.c
   lib_fileinstream.c
-  lib_fileoutstream.c)
+  lib_fileoutstream.c
+  lib_libbsprintf.c
+  lib_libsprintf.c
+  lib_libvscanf.c
+  lib_libvsprintf.c
+  lib_ultoa_invert.c)
+
+if(CONFIG_LIBC_FLOATINGPOINT)
+  list(APPEND SRCS lib_dtoa_engine.c lib_dtoa_data.c)
+endif()
 
 if(CONFIG_FILE_STREAM)
   list(APPEND SRCS lib_stdinstream.c lib_stdoutstream.c lib_stdsistream.c
diff --git a/libs/libc/stream/Make.defs b/libs/libc/stream/Make.defs
index 1d8dd421d7..191ef99557 100644
--- a/libs/libc/stream/Make.defs
+++ b/libs/libc/stream/Make.defs
@@ -30,7 +30,12 @@ CSRCS += lib_zeroinstream.c lib_nullinstream.c 
lib_nulloutstream.c
 CSRCS += lib_mtdoutstream.c lib_libnoflush.c lib_libsnoflush.c
 CSRCS += lib_syslogstream.c lib_syslograwstream.c lib_bufferedoutstream.c
 CSRCS += lib_hexdumpstream.c lib_base64outstream.c lib_mtdsostream.c
-CSRCS += lib_fileinstream.c lib_fileoutstream.c
+CSRCS += lib_fileinstream.c lib_fileoutstream.c lib_libbsprintf.c
+CSRCS += lib_libsprintf.c lib_libvscanf.c lib_libvsprintf.c lib_ultoa_invert.c
+
+ifeq ($(CONFIG_LIBC_FLOATINGPOINT),y)
+CSRCS += lib_dtoa_engine.c lib_dtoa_data.c
+endif
 
 # The remaining sources files depend upon C streams
 
diff --git a/libs/libc/stdio/lib_dtoa_data.c b/libs/libc/stream/lib_dtoa_data.c
similarity index 99%
rename from libs/libc/stdio/lib_dtoa_data.c
rename to libs/libc/stream/lib_dtoa_data.c
index 4ae66ff6c1..c0f5361346 100644
--- a/libs/libc/stdio/lib_dtoa_data.c
+++ b/libs/libc/stream/lib_dtoa_data.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_dtoa_data.c
+ * libs/libc/stream/lib_dtoa_data.c
  *
  * SPDX-License-Identifier: BSD-3-Clause
  * SPDX-FileCopyrightText: 2018, Keith Packard. All rights reserved.
diff --git a/libs/libc/stdio/lib_dtoa_engine.c 
b/libs/libc/stream/lib_dtoa_engine.c
similarity index 99%
rename from libs/libc/stdio/lib_dtoa_engine.c
rename to libs/libc/stream/lib_dtoa_engine.c
index 63ec9b14ca..e4e64baa04 100644
--- a/libs/libc/stdio/lib_dtoa_engine.c
+++ b/libs/libc/stream/lib_dtoa_engine.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_dtoa_engine.c
+ * libs/libc/stream/lib_dtoa_engine.c
  *
  * SPDX-License-Identifier: BSD-3-Clause
  * SPDX-FileCopyrightText: 2018, Keith Packard. All rights reserved.
diff --git a/libs/libc/stdio/lib_dtoa_engine.h 
b/libs/libc/stream/lib_dtoa_engine.h
similarity index 97%
rename from libs/libc/stdio/lib_dtoa_engine.h
rename to libs/libc/stream/lib_dtoa_engine.h
index ab6e2ce890..49ecfcb111 100644
--- a/libs/libc/stdio/lib_dtoa_engine.h
+++ b/libs/libc/stream/lib_dtoa_engine.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_dtoa_engine.h
+ * libs/libc/stream/lib_dtoa_engine.h
  *
  * SPDX-License-Identifier: BSD-3-Clause
  * SPDX-FileCopyrightText: 2018, Keith Packard. All rights reserved.
@@ -33,8 +33,8 @@
  *
  ****************************************************************************/
 
-#ifndef __LIBS_LIBC_STDIO_LIB_DTOA_ENGINE_H
-#define __LIBS_LIBC_STDIO_LIB_DTOA_ENGINE_H
+#ifndef __LIBS_LIBC_STREAM_LIB_DTOA_ENGINE_H
+#define __LIBS_LIBC_STREAM_LIB_DTOA_ENGINE_H
 
 /****************************************************************************
  * Included Files
@@ -188,4 +188,4 @@ extern const double g_dtoa_round[];
 int __dtoa_engine(double x, FAR struct dtoa_s *dtoa, int max_digits,
                   int max_decimals);
 
-#endif /* __LIBS_LIBC_STDIO_LIB_DTOA_ENGINE_H */
+#endif /* __LIBS_LIBC_STREAM_LIB_DTOA_ENGINE_H */
diff --git a/libs/libc/stdio/lib_libbsprintf.c 
b/libs/libc/stream/lib_libbsprintf.c
similarity index 99%
rename from libs/libc/stdio/lib_libbsprintf.c
rename to libs/libc/stream/lib_libbsprintf.c
index 4520113d0e..20382ffc31 100644
--- a/libs/libc/stdio/lib_libbsprintf.c
+++ b/libs/libc/stream/lib_libbsprintf.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_libbsprintf.c
+ * libs/libc/stream/lib_libbsprintf.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/libs/libc/stdio/lib_libsprintf.c 
b/libs/libc/stream/lib_libsprintf.c
similarity index 98%
rename from libs/libc/stdio/lib_libsprintf.c
rename to libs/libc/stream/lib_libsprintf.c
index fdfca626a0..6ed53ddf68 100644
--- a/libs/libc/stdio/lib_libsprintf.c
+++ b/libs/libc/stream/lib_libsprintf.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_libsprintf.c
+ * libs/libc/stream/lib_libsprintf.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/libs/libc/stdio/lib_libvscanf.c b/libs/libc/stream/lib_libvscanf.c
similarity index 99%
rename from libs/libc/stdio/lib_libvscanf.c
rename to libs/libc/stream/lib_libvscanf.c
index 970cdade14..aaa7857b63 100644
--- a/libs/libc/stdio/lib_libvscanf.c
+++ b/libs/libc/stream/lib_libvscanf.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_libvscanf.c
+ * libs/libc/stream/lib_libvscanf.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/libs/libc/stdio/lib_libvsprintf.c 
b/libs/libc/stream/lib_libvsprintf.c
similarity index 99%
rename from libs/libc/stdio/lib_libvsprintf.c
rename to libs/libc/stream/lib_libvsprintf.c
index 610a6a42d9..6a85af3adc 100644
--- a/libs/libc/stdio/lib_libvsprintf.c
+++ b/libs/libc/stream/lib_libvsprintf.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_libvsprintf.c
+ * libs/libc/stream/lib_libvsprintf.c
  *
  * SPDX-License-Identifier: BSD-3-Clause
  * SPDX-FileCopyrightText: 2002, Alexander Popov (sa...@vip.bg)
diff --git a/libs/libc/stdio/lib_ultoa_invert.c 
b/libs/libc/stream/lib_ultoa_invert.c
similarity index 98%
rename from libs/libc/stdio/lib_ultoa_invert.c
rename to libs/libc/stream/lib_ultoa_invert.c
index 8c4aeabaf9..eaad31f975 100644
--- a/libs/libc/stdio/lib_ultoa_invert.c
+++ b/libs/libc/stream/lib_ultoa_invert.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_ultoa_invert.c
+ * libs/libc/stream/lib_ultoa_invert.c
  *
  * SPDX-License-Identifier: BSD-3-Clause
  * SPDX-FileCopyrightText: 2017, Keith Packard. All rights reserved.
diff --git a/libs/libc/stdio/lib_ultoa_invert.h 
b/libs/libc/stream/lib_ultoa_invert.h
similarity index 94%
rename from libs/libc/stdio/lib_ultoa_invert.h
rename to libs/libc/stream/lib_ultoa_invert.h
index 52a3792945..8f7289ea99 100644
--- a/libs/libc/stdio/lib_ultoa_invert.h
+++ b/libs/libc/stream/lib_ultoa_invert.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * libs/libc/stdio/lib_ultoa_invert.h
+ * libs/libc/stream/lib_ultoa_invert.h
  *
  * SPDX-License-Identifier: BSD-3-Clause
  * SPDX-FileCopyrightText: 2005, Dmitry Xmelkov. All rights reserved.
@@ -33,8 +33,8 @@
  *
  ****************************************************************************/
 
-#ifndef __LIBS_LIBC_STDIO_LIB_ULTOA_INVERT_H
-#define __LIBS_LIBC_STDIO_LIB_ULTOA_INVERT_H
+#ifndef __LIBS_LIBC_STREAM_LIB_ULTOA_INVERT_H
+#define __LIBS_LIBC_STREAM_LIB_ULTOA_INVERT_H
 
 /****************************************************************************
  * Included Files
@@ -71,4 +71,4 @@ FAR char *__ultoa_invert(unsigned long long val, FAR char 
*str, int base);
 FAR char *__ultoa_invert(unsigned long val, FAR char *str, int base);
 #endif
 
-#endif /* __LIBS_LIBC_STDIO_LIB_ULTOA_INVERT_H */
+#endif /* __LIBS_LIBC_STREAM_LIB_ULTOA_INVERT_H */

Reply via email to