summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-03-17 14:06:48 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-17 14:06:48 +0100
commit2dc1a5ce93514d4354fa01229756fc48c00513d9 (patch)
tree63554b3a7c3e0bc85e9da9713316438c58b757e9
parent0037eb58052b19bad7ce55b2317a19283c644637 (diff)
downloadcurl-2dc1a5ce93514d4354fa01229756fc48c00513d9.tar.gz
checksrc: detect and remove space before trailing semicolons
-rwxr-xr-xlib/checksrc.pl5
-rw-r--r--lib/http.c2
-rw-r--r--lib/http_chunks.c2
-rw-r--r--lib/memdebug.c32
-rw-r--r--lib/tftp.c6
-rw-r--r--lib/vtls/openssl.c2
-rw-r--r--lib/vtls/polarssl.c2
-rw-r--r--src/tool_urlglob.h4
8 files changed, 30 insertions, 25 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index 190f00c93..7a7e3a94c 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -216,6 +216,11 @@ sub scanfile {
checkwarn($line, length($1)+1, $file, $l, "missing space after close paren");
}
+ # check for space before the semicolon last in a line
+ if($l =~ /^(.*[^ ].*) ;$/) {
+ checkwarn($line, length($1), $file, $l, "space before last semicolon");
+ }
+
# scan for use of banned functions
if($l =~ /^(.*\W)(sprintf|vsprintf|strcat|strncat|gets)\s*\(/) {
checkwarn($line, length($1), $file, $l,
diff --git a/lib/http.c b/lib/http.c
index 0c08204f2..0af471045 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -731,7 +731,7 @@ Curl_http_output_auth(struct connectdata *conn,
if((conn->bits.httpproxy && conn->bits.proxy_user_passwd) ||
conn->bits.user_passwd)
- /* continue please */ ;
+ /* continue please */;
else {
authhost->done = TRUE;
authproxy->done = TRUE;
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index 3f5003e84..0b1a5ed37 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -155,7 +155,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
if(result) {
/* Curl_convert_from_network calls failf if unsuccessful */
/* Treat it as a bad hex character */
- return CHUNKE_ILLEGAL_HEX ;
+ return CHUNKE_ILLEGAL_HEX;
}
ch->datasize=curlx_strtoofft(ch->hexbuffer, &endptr, 16);
diff --git a/lib/memdebug.c b/lib/memdebug.c
index 931a9f757..3b38a7492 100644
--- a/lib/memdebug.c
+++ b/lib/memdebug.c
@@ -342,10 +342,10 @@ curl_socket_t curl_socket(int domain, int type, int protocol,
int line, const char *source)
{
const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?
- "FD %s:%d socket() = %d\n" :
- (sizeof(curl_socket_t) == sizeof(long)) ?
- "FD %s:%d socket() = %ld\n" :
- "FD %s:%d socket() = %zd\n" ;
+ "FD %s:%d socket() = %d\n" :
+ (sizeof(curl_socket_t) == sizeof(long)) ?
+ "FD %s:%d socket() = %ld\n" :
+ "FD %s:%d socket() = %zd\n";
curl_socket_t sockfd = socket(domain, type, protocol);
@@ -361,10 +361,10 @@ int curl_socketpair(int domain, int type, int protocol,
int line, const char *source)
{
const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?
- "FD %s:%d socketpair() = %d %d\n" :
- (sizeof(curl_socket_t) == sizeof(long)) ?
- "FD %s:%d socketpair() = %ld %ld\n" :
- "FD %s:%d socketpair() = %zd %zd\n" ;
+ "FD %s:%d socketpair() = %d %d\n" :
+ (sizeof(curl_socket_t) == sizeof(long)) ?
+ "FD %s:%d socketpair() = %ld %ld\n" :
+ "FD %s:%d socketpair() = %zd %zd\n";
int res = socketpair(domain, type, protocol, socket_vector);
@@ -379,10 +379,10 @@ curl_socket_t curl_accept(curl_socket_t s, void *saddr, void *saddrlen,
int line, const char *source)
{
const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?
- "FD %s:%d accept() = %d\n" :
- (sizeof(curl_socket_t) == sizeof(long)) ?
- "FD %s:%d accept() = %ld\n" :
- "FD %s:%d accept() = %zd\n" ;
+ "FD %s:%d accept() = %d\n" :
+ (sizeof(curl_socket_t) == sizeof(long)) ?
+ "FD %s:%d accept() = %ld\n" :
+ "FD %s:%d accept() = %zd\n";
struct sockaddr *addr = (struct sockaddr *)saddr;
curl_socklen_t *addrlen = (curl_socklen_t *)saddrlen;
@@ -399,10 +399,10 @@ curl_socket_t curl_accept(curl_socket_t s, void *saddr, void *saddrlen,
void curl_mark_sclose(curl_socket_t sockfd, int line, const char *source)
{
const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?
- "FD %s:%d sclose(%d)\n" :
- (sizeof(curl_socket_t) == sizeof(long)) ?
- "FD %s:%d sclose(%ld)\n" :
- "FD %s:%d sclose(%zd)\n" ;
+ "FD %s:%d sclose(%d)\n":
+ (sizeof(curl_socket_t) == sizeof(long)) ?
+ "FD %s:%d sclose(%ld)\n":
+ "FD %s:%d sclose(%zd)\n";
if(source)
curl_memlog(fmt, source, line, sockfd);
diff --git a/lib/tftp.c b/lib/tftp.c
index f837b35d1..56dabc6df 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -145,8 +145,8 @@ typedef struct tftp_state_data {
/* Forward declarations */
-static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) ;
-static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) ;
+static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event);
+static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event);
static CURLcode tftp_connect(struct connectdata *conn, bool *done);
static CURLcode tftp_disconnect(struct connectdata *conn,
bool dead_connection);
@@ -218,7 +218,7 @@ static CURLcode tftp_set_timeouts(tftp_state_data_t *state)
state->max_time = state->start_time+maxtime;
/* Set per-block timeout to total */
- timeout = maxtime ;
+ timeout = maxtime;
/* Average restart after 5 seconds */
state->retry_max = (int)timeout/5;
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index f5610bb1e..f0c97f044 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -1236,7 +1236,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert)
unsigned char *nulstr = (unsigned char *)"";
unsigned char *peer_CN = nulstr;
- X509_NAME *name = X509_get_subject_name(server_cert) ;
+ X509_NAME *name = X509_get_subject_name(server_cert);
if(name)
while((j = X509_NAME_get_index_by_NID(name, NID_commonName, i))>=0)
i=j;
diff --git a/lib/vtls/polarssl.c b/lib/vtls/polarssl.c
index cafcec2b3..0a7311c2c 100644
--- a/lib/vtls/polarssl.c
+++ b/lib/vtls/polarssl.c
@@ -496,7 +496,7 @@ polarssl_connect_step3(struct connectdata *conn,
struct ssl_connect_data *connssl = &conn->ssl[sockindex];
struct SessionHandle *data = conn->data;
void *old_ssl_sessionid = NULL;
- ssl_session *our_ssl_sessionid = &conn->ssl[sockindex].ssn ;
+ ssl_session *our_ssl_sessionid = &conn->ssl[sockindex].ssn;
bool incache;
DEBUGASSERT(ssl_connect_3 == connssl->connecting_state);
diff --git a/src/tool_urlglob.h b/src/tool_urlglob.h
index 7a9ec5943..62c1abdd6 100644
--- a/src/tool_urlglob.h
+++ b/src/tool_urlglob.h
@@ -7,7 +7,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
@@ -51,7 +51,7 @@ typedef struct {
int padlength;
unsigned long ptr_n;
unsigned long step;
- } NumRange ;
+ } NumRange;
} content;
} URLPattern;