]> granicus.if.org Git - curl/commitdiff
checksrc: use space before paren in "return (expr);"
authorDaniel Stenberg <daniel@haxx.se>
Tue, 17 Mar 2015 12:05:01 +0000 (13:05 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 17 Mar 2015 12:05:01 +0000 (13:05 +0100)
lib/checksrc.pl
lib/ftp.c
lib/select.c
lib/sendf.c
lib/socks_gssapi.c
lib/tftp.c
lib/transfer.c

index f561492a7b967456f594a04d8c395861bcf1df9d..c4174709b02e4eeca85db5f6a3a48f7b1da4e37a 100755 (executable)
@@ -6,7 +6,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 2011 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 2011 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
@@ -144,6 +144,17 @@ sub scanfile {
             }
         }
 
+        # check for "return(" without space
+        if($l =~ /^(.*)return\(/) {
+            if($1 =~ / *\#/) {
+                # this is a #if, treat it differently
+            }
+            else {
+                checkwarn($line, length($1)+6, $file, $l,
+                          "return without space before paren");
+            }
+        }
+        
         # check for "} else"
         if($l =~ /^(.*)\} *else/) {
             checkwarn($line, length($1), $file, $l, "else after closing brace on same line");
index 33775595569f678ae36af051343d13ca3e40c6c4..286d00a5d30b0d096e8fe3d6afdc5fc2465cd631 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -4087,7 +4087,7 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
   result = Curl_convert_to_network(conn->data, s, write_len);
   /* Curl_convert_to_network calls failf if unsuccessful */
   if(result)
-    return(result);
+    return result;
 
   for(;;) {
 #ifdef HAVE_GSSAPI
index 1c6481cb75a45967e9fcbc15acf483350685ad59..ca9f7015c31283d57ac5e7dc2981aa8378f0f51b 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -573,6 +573,6 @@ int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes,
 
    rc = tpf_select_bsd(maxfds, reads, writes, excepts, tv);
    tpf_process_signals();
-   return(rc);
+   return rc;
 }
 #endif /* TPF */
index 812f69daebe8506d777b670cdb8e28061f7f8b4b..96899f466ad313cf775e06f31eee64ac0b4a4d6e 100644 (file)
@@ -52,7 +52,7 @@ static size_t convert_lineends(struct SessionHandle *data,
 
   /* sanity check */
   if((startPtr == NULL) || (size < 1)) {
-    return(size);
+    return size;
   }
 
   if(data->state.prev_block_had_trailing_cr) {
@@ -114,9 +114,9 @@ static size_t convert_lineends(struct SessionHandle *data,
       /* tidy up by null terminating the now shorter data */
       *outPtr = '\0';
 
-    return(outPtr - startPtr);
+    return (outPtr - startPtr);
   }
-  return(size);
+  return size;
 }
 #endif /* CURL_DO_LINEEND_CONV */
 
index 188c87096315e728af15f9c2e4f3dde262481076..d117d6d7d98e1631e68cf2f932bacb926de9e4ae 100644 (file)
@@ -92,10 +92,10 @@ static int check_gss_err(struct SessionHandle *data,
       gss_release_buffer(&min_stat, &status_string);
     }
     failf(data, "GSS-API error: %s failed:\n%s", function, buf);
-    return(1);
+    return 1;
   }
 
-  return(0);
+  return 0;
 }
 
 CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
index 61dc70e366b53260911ed89cdde175854afc32f2..f837b35d13eb59f165ff3b03133374cd67f56c75 100644 (file)
@@ -408,7 +408,7 @@ static size_t tftp_option_add(tftp_state_data_t *state, size_t csize,
   if(( strlen(option) + csize + 1 ) > (size_t)state->blksize)
     return 0;
   strcpy(buf, option);
-  return( strlen(option) + 1 );
+  return strlen(option) + 1;
 }
 
 static CURLcode tftp_connect_for_tx(tftp_state_data_t *state,
@@ -423,7 +423,7 @@ static CURLcode tftp_connect_for_tx(tftp_state_data_t *state,
   state->state = TFTP_STATE_TX;
   result = tftp_set_timeouts(state);
   if(result)
-    return(result);
+    return result;
   return tftp_tx(state, event);
 }
 
@@ -439,7 +439,7 @@ static CURLcode tftp_connect_for_rx(tftp_state_data_t *state,
   state->state = TFTP_STATE_RX;
   result = tftp_set_timeouts(state);
   if(result)
-    return(result);
+    return result;
   return tftp_rx(state, event);
 }
 
@@ -1210,7 +1210,7 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
   else if(event != TFTP_EVENT_NONE) {
     result = tftp_state_machine(state, event);
     if(result)
-      return(result);
+      return result;
     *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
     if(*done)
       /* Tell curl we're done */
@@ -1229,10 +1229,10 @@ static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done)
     else if(rc != 0) {
       result = tftp_receive_packet(conn);
       if(result)
-        return(result);
+        return result;
       result = tftp_state_machine(state, state->event);
       if(result)
-        return(result);
+        return result;
       *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
       if(*done)
         /* Tell curl we're done */
index 3961aa8d2d8d07dd28a100035fdfed28f19cd4d9..849a8128bc56a8c3b8ea2172e21fa6cc371d9fc1 100644 (file)
@@ -214,7 +214,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
     result = Curl_convert_to_network(data, data->req.upload_fromhere, length);
     /* Curl_convert_to_network calls failf if unsuccessful */
     if(result)
-      return(result);
+      return result;
 #endif /* CURL_DOES_CONVERSIONS */
 
     if((nread - hexlen) == 0)