You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/11/27 21:36:45 UTC

[nuttx-apps] branch master updated: Remove the unnecessary "return;" at the end of function

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8fff07b43 Remove the unnecessary "return;" at the end of function
8fff07b43 is described below

commit 8fff07b435f31dbb78f2d26d5395e673724a8929
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Nov 28 03:55:23 2022 +0800

    Remove the unnecessary "return;" at the end of function
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 examples/tcp_ipc_server/uart_lorawan_layer.c |  1 -
 interpreters/ficl/src/nuttx.c                |  3 +-
 interpreters/minibasic/basic.c               | 65 ++++++++++++++++------------
 netutils/thttpd/thttpd.c                     |  2 -
 4 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/examples/tcp_ipc_server/uart_lorawan_layer.c b/examples/tcp_ipc_server/uart_lorawan_layer.c
index cbf5650f0..d7c255464 100644
--- a/examples/tcp_ipc_server/uart_lorawan_layer.c
+++ b/examples/tcp_ipc_server/uart_lorawan_layer.c
@@ -436,7 +436,6 @@ void lorawan_radioenge_init(config_lorawan_radioenge_t config_lorawan)
   clear_uart_rx_buffer();
 
 END_UART_LORAWAN_MODULE_INIT:
-  return;
 }
 
 /****************************************************************************
diff --git a/interpreters/ficl/src/nuttx.c b/interpreters/ficl/src/nuttx.c
index 0aacffc15..5d01b8c84 100644
--- a/interpreters/ficl/src/nuttx.c
+++ b/interpreters/ficl/src/nuttx.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/interpreters/minibasic/basic.c
+ * apps/interpreters/ficl/src/nuttx.c
  *
  *   Copyright (C) 2016 Gregory Nutt. All rights reserved.
  *
@@ -113,5 +113,4 @@ long ficlFileSize(ficlFile *ff)
 
 void ficlSystemCompilePlatform(ficlSystem *system)
 {
-  return;
 }
diff --git a/interpreters/minibasic/basic.c b/interpreters/minibasic/basic.c
index b9dabe6d5..e9de97c03 100644
--- a/interpreters/minibasic/basic.c
+++ b/interpreters/minibasic/basic.c
@@ -53,6 +53,7 @@
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
+
 /* Configuration */
 
 #ifndef CONFIG_INTERPRETER_MINIBASIC_IOBUFSIZE
@@ -375,17 +376,19 @@ static int setup(FAR const char *script)
     }
 
   for (i = 1; i < nlines; i++)
-    if (g_lines[i].no <= g_lines[i - 1].no)
-      {
-        if (g_fperr)
-          {
-            fprintf(g_fperr, "program lines %d and %d not in order\n",
-                    g_lines[i - 1].no, g_lines[i].no);
-          }
+    {
+      if (g_lines[i].no <= g_lines[i - 1].no)
+        {
+          if (g_fperr)
+            {
+              fprintf(g_fperr, "program lines %d and %d not in order\n",
+                      g_lines[i - 1].no, g_lines[i].no);
+            }
 
-        free(g_lines);
-        return -1;
-      }
+          free(g_lines);
+          return -1;
+        }
+    }
 
   g_nvariables = 0;
   g_variables = 0;
@@ -451,7 +454,6 @@ static void cleanup(void)
         }
       else if (g_dimvariables[i].dval)
         {
-
           free(g_dimvariables[i].dval);
         }
     }
@@ -701,6 +703,7 @@ static int line(void)
   if (g_token != EOS)
     {
       /* match(VALUE); */
+
       /* check for a newline */
 
       str = g_string;
@@ -874,7 +877,8 @@ static void dodim(void)
           break;
 
         case 3:
-          dimvar = dimension(name, 3, (int)dims[0], (int)dims[1], (int)dims[2]);
+          dimvar = dimension(name, 3, (int)dims[0],
+                             (int)dims[1], (int)dims[2]);
           break;
 
         case 4:
@@ -1177,7 +1181,7 @@ static void doinput(void)
          * or comma is detected.
          */
 
-        for (nch = 0, ptr = g_iobuffer; nch < (IOBUFSIZE-1); nch++)
+        for (nch = 0, ptr = g_iobuffer; nch < (IOBUFSIZE - 1); nch++)
           {
             int ch = fgetc(g_fpin);
             if (ch == EOF)
@@ -1256,7 +1260,6 @@ static void doinput(void)
 static void dorem(void)
 {
   match(REM);
-  return;
 }
 
 /****************************************************************************
@@ -1372,7 +1375,8 @@ static void lvalue(FAR struct mb_lvalue_s *lv)
                   index[2] = integer(expr());
                   if (g_errorflag == 0)
                     {
-                      valptr = getdimvar(dimvar, index[0], index[1], index[2]);
+                      valptr = getdimvar(dimvar, index[0],
+                                         index[1], index[2]);
                     }
                 }
                 break;
@@ -1388,8 +1392,8 @@ static void lvalue(FAR struct mb_lvalue_s *lv)
                   index[3] = integer(expr());
                   if (g_errorflag == 0)
                     {
-                      valptr =
-                        getdimvar(dimvar, index[0], index[1], index[2], index[3]);
+                      valptr = getdimvar(dimvar, index[0],
+                                         index[1], index[2], index[3]);
                     }
                 }
                 break;
@@ -1407,8 +1411,8 @@ static void lvalue(FAR struct mb_lvalue_s *lv)
                   index[4] = integer(expr());
                   if (g_errorflag == 0)
                     {
-                      valptr =
-                        getdimvar(dimvar, index[0], index[1], index[2], index[3]);
+                      valptr = getdimvar(dimvar, index[0],
+                                         index[1], index[2], index[3]);
                     }
                 }
                 break;
@@ -1530,6 +1534,7 @@ static int boolfactor(void)
 
               return 0;
             }
+
           cmp = strcmp(strleft, strright);
           switch (op)
             {
@@ -1960,6 +1965,7 @@ static double factor(void)
             {
               srand((unsigned)-answer);
             }
+
           answer = 0;
         }
       break;
@@ -2179,8 +2185,8 @@ static double dimvariable(void)
           index[3] = integer(expr());
           match(COMMA);
           index[4] = integer(expr());
-          answer =
-            getdimvar(dimvar, index[0], index[1], index[2], index[3], index[4]);
+          answer = getdimvar(dimvar, index[0], index[1],
+                             index[2], index[3], index[4]);
           break;
         }
 
@@ -2562,8 +2568,8 @@ static FAR struct mb_dimvar_s *adddimvar(FAR const char *id)
 {
   FAR struct mb_dimvar_s *vars;
 
-  vars =
-    realloc(g_dimvariables, (g_ndimvariables + 1) * sizeof(struct mb_dimvar_s));
+  vars = realloc(g_dimvariables,
+                 (g_ndimvariables + 1) * sizeof(struct mb_dimvar_s));
   if (vars)
     {
       g_dimvariables = vars;
@@ -2571,7 +2577,7 @@ static FAR struct mb_dimvar_s *adddimvar(FAR const char *id)
       g_dimvariables[g_ndimvariables].dval  = NULL;
       g_dimvariables[g_ndimvariables].str   = NULL;
       g_dimvariables[g_ndimvariables].ndims = 0;
-      g_dimvariables[g_ndimvariables].type  = strchr(id, '$') ? STRID : FLTID;
+      g_dimvariables[g_ndimvariables].type = strchr(id, '$') ? STRID : FLTID;
       g_ndimvariables++;
       return &g_dimvariables[g_ndimvariables - 1];
     }
@@ -3039,7 +3045,8 @@ static FAR char *stringdimvar(void)
           match(COMMA);
           index[4] = integer(expr());
           answer =
-            getdimvar(dimvar, index[0], index[1], index[2], index[3], index[4]);
+            getdimvar(dimvar, index[0], index[1],
+                      index[2], index[3], index[4]);
           break;
         }
 
@@ -3189,7 +3196,7 @@ static int integer(double x)
  * Name: match
  *
  * Description:
- *   Check that we have a token of the passed type (if not set the g_errorflag)
+ *   Check that we have a token of the passed type (if not set g_errorflag)
  *   Move parser on to next token. Sets token and string.
  *
  ****************************************************************************/
@@ -3944,7 +3951,10 @@ static FAR char *mystrend(FAR const char *str, char quote)
       while (*str != quote)
         {
           if (*str == '\n' || *str == 0)
-            return 0;
+            {
+              return 0;
+            }
+
           str++;
         }
 
@@ -4133,6 +4143,7 @@ int basic(FAR const char *script, FILE * in, FILE * out, FILE * err)
                 {
                   fprintf(g_fperr, "line %d not found\n", nextline);
                 }
+
               answer = 1;
               break;
             }
diff --git a/netutils/thttpd/thttpd.c b/netutils/thttpd/thttpd.c
index 6d9ca78ba..5a662fcd9 100644
--- a/netutils/thttpd/thttpd.c
+++ b/netutils/thttpd/thttpd.c
@@ -396,7 +396,6 @@ errout_with_400:
 
 errout_with_connection:
   finish_connection(conn, tv);
-  return;
 }
 
 static inline int read_buffer(struct connect_s *conn)
@@ -490,7 +489,6 @@ static void handle_send(struct connect_s *conn, struct timeval *tv)
 errout_clear_connection:
   ninfo("Clear connection\n");
   clear_connection(conn, tv);
-  return;
 }
 
 static void handle_linger(struct connect_s *conn, struct timeval *tv)