aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-03-17 13:05:01 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-17 13:05:01 +0100
commita6b8fe2a5f6f18bd1a6fd0767a961fa1e87aba3e (patch)
tree2ec419b11c482a34aaa1229b2ef0b12968ceecd0
parent3dbe12a1e9eb7fc4b4a4172c244c460d3e021143 (diff)
checksrc: use space before paren in "return (expr);"
-rwxr-xr-xlib/checksrc.pl13
-rw-r--r--lib/ftp.c2
-rw-r--r--lib/select.c4
-rw-r--r--lib/sendf.c6
-rw-r--r--lib/socks_gssapi.c4
-rw-r--r--lib/tftp.c12
-rw-r--r--lib/transfer.c2
7 files changed, 27 insertions, 16 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index f561492a7..c4174709b 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -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");
diff --git a/lib/ftp.c b/lib/ftp.c
index 337755955..286d00a5d 100644
--- 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
diff --git a/lib/select.c b/lib/select.c
index 1c6481cb7..ca9f7015c 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -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 */
diff --git a/lib/sendf.c b/lib/sendf.c
index 812f69dae..96899f466 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -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 */
diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c
index 188c87096..d117d6d7d 100644
--- a/lib/socks_gssapi.c
+++ b/lib/socks_gssapi.c
@@ -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,
diff --git a/lib/tftp.c b/lib/tftp.c
index 61dc70e36..f837b35d1 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -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 */
diff --git a/lib/transfer.c b/lib/transfer.c
index 3961aa8d2..849a8128b 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -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)