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

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

commit b8835be6c51464bc268daca3289126ae261bcff2
Author: likun17 <[email protected]>
AuthorDate: Fri May 31 14:58:48 2024 +0800

    libs/libc/stdio: Optimize header file dependencies in *scanf.c file.
    
    Signed-off-by: likun17 <[email protected]>
---
 libs/libc/stdio/lib_fscanf.c    |  2 --
 libs/libc/stdio/lib_libvscanf.c | 46 +++--------------------------------------
 libs/libc/stdio/lib_scanf.c     |  1 -
 libs/libc/stdio/lib_sscanf.c    |  3 ---
 libs/libc/stdio/lib_vfscanf.c   |  6 ------
 5 files changed, 3 insertions(+), 55 deletions(-)

diff --git a/libs/libc/stdio/lib_fscanf.c b/libs/libc/stdio/lib_fscanf.c
index 3f0e4e8796..3e511eabd7 100644
--- a/libs/libc/stdio/lib_fscanf.c
+++ b/libs/libc/stdio/lib_fscanf.c
@@ -23,8 +23,6 @@
  ****************************************************************************/
 
 #include <stdio.h>
-#include <stdarg.h>
-#include "libc.h"
 
 /****************************************************************************
  * Public Functions
diff --git a/libs/libc/stdio/lib_libvscanf.c b/libs/libc/stdio/lib_libvscanf.c
index 8c6517999b..da73e1eed1 100644
--- a/libs/libc/stdio/lib_libvscanf.c
+++ b/libs/libc/stdio/lib_libvscanf.c
@@ -22,21 +22,13 @@
  * Included Files
  ****************************************************************************/
 
-#include <nuttx/compiler.h>
+#include <nuttx/streams.h>
 
-#include <stdarg.h>
+#include <errno.h>
+#include <string.h>
 #include <stdlib.h>
 #include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
 #include <ctype.h>
-#include <errno.h>
-#include <debug.h>
-
-#include <nuttx/compiler.h>
-#include <nuttx/streams.h>
-
-#include "libc.h"
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -251,10 +243,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
   unsigned char set[32];        /* Bit field (256 / 8) */
 #endif
 
-  /* keep this for future reference:
-   * linfo("buf=\"%s\" fmt=\"%s\"\n", buf, fmt);
-   */
-
   /* Parse the format, extracting values from the input buffer as needed */
 
   assigncount = 0;
@@ -302,15 +290,11 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
 
       if (fmt_char(fmt) == '%')
         {
-          linfo("Specifier found\n");
-
           /* Check for qualifiers on the conversion specifier */
 
           fmt++;
           for (; fmt_char(fmt); fmt++)
             {
-              linfo("Processing %c\n", fmt_char(fmt));
-
 #ifdef CONFIG_LIBC_SCANSET
               if (strchr("diboupxXcseEfFgGaAn[%", fmt_char(fmt)))
 #else
@@ -402,8 +386,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
 
           if (fmt_char(fmt) == 's')
             {
-              linfo("Performing string conversion\n");
-
               /* Get a pointer to the char * value.  We need to do this even
                * of we have reached the end of the input data in order to
                * update the 'ap' variable.
@@ -462,8 +444,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
 
           if (fmt_char(fmt) == '[')
             {
-              linfo("Performing scanset conversion\n");
-
               fmt = findscanset(fmt, set);      /* find scanset */
 
               /* Get a pointer to the char * value.  We need to do this even
@@ -523,8 +503,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
 
           else if (fmt_char(fmt) == 'c')
             {
-              linfo("Performing character conversion\n");
-
               /* Get a pointer to the char * value.  We need to do this even
                * if we have reached the end of the input data in order to
                * update the 'ap' variable.
@@ -587,8 +565,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
             {
               bool sign;
 
-              linfo("Performing integer conversion\n");
-
               /* Get a pointer to the integer value.  We need to do this even
                * if we have reached the end of the input data in order to
                * update the 'ap' variable.
@@ -860,8 +836,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
 
                   tmp[fwidth] = 0;
 
-                  linfo("tmp[]=\"%s\"\n", tmp);
-
                   /* Perform the integer conversion */
 
                   /* Preserve the errno value */
@@ -928,17 +902,14 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
                       switch (modifier)
                         {
                         case HH_MOD:
-                          linfo("Return %ld to %p\n", tmplong, pchar);
                           *pchar = (unsigned char)tmplong;
                           break;
 
                         case H_MOD:
-                          linfo("Return %ld to %p\n", tmplong, pshort);
                           *pshort = (unsigned short)tmplong;
                           break;
 
                         case NO_MOD:
-                          linfo("Return %ld to %p\n", tmplong, pint);
                           *pint = (unsigned int)tmplong;
                           break;
 
@@ -946,14 +917,11 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
                         case L_MOD:
 #endif
                         default:
-                          linfo("Return %ld to %p\n", tmplong, plong);
                           *plong = tmplong;
                           break;
 
 #ifdef CONFIG_HAVE_LONG_LONG
                         case LL_MOD:
-                          linfo("Return %lld to %p\n", tmplonglong,
-                                plonglong);
                           *plonglong = tmplonglong;
                           break;
 #endif
@@ -980,8 +948,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
               FAR float *pf = NULL;
 #endif
 
-              linfo("Performing floating point conversion\n");
-
               /* Get a pointer to the double value.  We need to do this even
                * if we have reached the end of the input data in order to
                * upate the 'ap' variable.
@@ -1108,8 +1074,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
 
                   tmp[fwidth] = 0;
 
-                  linfo("tmp[]=\"%s\"\n", tmp);
-
                   /* Perform the floating point conversion */
 
                   /* Preserve the errno value */
@@ -1155,7 +1119,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
                         {
                           /* Return the double value */
 
-                          linfo("Return %f to %p\n", dvalue, pd);
                           *pd = dvalue;
                         }
                       else
@@ -1164,7 +1127,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
                           /* Return the float value */
 
 #  ifdef CONFIG_HAVE_FLOAT
-                          linfo("Return %f to %p\n", (double)fvalue, pf);
                           *pf = fvalue;
 #  endif
                         }
@@ -1181,8 +1143,6 @@ static int vscanf_internal(FAR struct lib_instream_s 
*stream, FAR int *lastc,
 
           else if (fmt_char(fmt) == 'n')
             {
-              linfo("Performing character count\n");
-
               if (!noassign)
                 {
                   size_t nchars = (size_t) (stream->nget - ngetstart);
diff --git a/libs/libc/stdio/lib_scanf.c b/libs/libc/stdio/lib_scanf.c
index 9817c5fe59..349a1de7fa 100644
--- a/libs/libc/stdio/lib_scanf.c
+++ b/libs/libc/stdio/lib_scanf.c
@@ -23,7 +23,6 @@
  ****************************************************************************/
 
 #include <stdio.h>
-#include "libc.h"
 
 /****************************************************************************
  * Public Functions
diff --git a/libs/libc/stdio/lib_sscanf.c b/libs/libc/stdio/lib_sscanf.c
index 145c82f944..3349713496 100644
--- a/libs/libc/stdio/lib_sscanf.c
+++ b/libs/libc/stdio/lib_sscanf.c
@@ -23,9 +23,6 @@
  ****************************************************************************/
 
 #include <stdio.h>
-#include <stdarg.h>
-#include <nuttx/streams.h>
-#include "libc.h"
 
 /****************************************************************************
  * Public Functions
diff --git a/libs/libc/stdio/lib_vfscanf.c b/libs/libc/stdio/lib_vfscanf.c
index 703f3cb10e..9106b41b7a 100644
--- a/libs/libc/stdio/lib_vfscanf.c
+++ b/libs/libc/stdio/lib_vfscanf.c
@@ -22,14 +22,8 @@
  * Included Files
  ****************************************************************************/
 
-#include <nuttx/config.h>
-
-#include <stdio.h>
-
 #include <nuttx/streams.h>
 
-#include "libc.h"
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/

Reply via email to