Skip to content

Commit

Permalink
checksrc: use space after comma
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Mar 17, 2015
1 parent a6b8fe2 commit 9395999
Show file tree
Hide file tree
Showing 37 changed files with 171 additions and 140 deletions.
4 changes: 2 additions & 2 deletions lib/amigaos.c
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2012, 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
Expand Down Expand Up @@ -71,7 +71,7 @@ bool Curl_amiga_init()
}

#ifdef __libnix__
ADD2EXIT(Curl_amiga_cleanup,-50);
ADD2EXIT(Curl_amiga_cleanup, -50);
#endif

#endif /* __AMIGA__ && ! __ixemul__ */
6 changes: 3 additions & 3 deletions lib/asyn-ares.c
Expand Up @@ -164,7 +164,7 @@ void Curl_resolver_cleanup(void *resolver)
int Curl_resolver_duphandle(void **to, void *from)
{
/* Clone the ares channel for the new handle */
if(ARES_SUCCESS != ares_dup((ares_channel*)to,(ares_channel)from))
if(ARES_SUCCESS != ares_dup((ares_channel*)to, (ares_channel)from))
return CURLE_FAILED_INIT;
return CURLE_OK;
}
Expand Down Expand Up @@ -385,7 +385,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
timeout_ms = 1000;

waitperform(conn, timeout_ms);
Curl_resolver_is_resolved(conn,&temp_entry);
Curl_resolver_is_resolved(conn, &temp_entry);

if(conn->async.done)
break;
Expand Down Expand Up @@ -539,7 +539,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
conn->async.done = FALSE; /* not done */
conn->async.status = 0; /* clear */
conn->async.dns = NULL; /* clear */
res = calloc(sizeof(struct ResolverResults),1);
res = calloc(sizeof(struct ResolverResults), 1);
if(!res) {
free(conn->async.hostname);
conn->async.hostname = NULL;
Expand Down
2 changes: 1 addition & 1 deletion lib/asyn-thread.c
Expand Up @@ -195,7 +195,7 @@ void destroy_thread_sync_data(struct thread_sync_data * tsd)
if(tsd->res)
Curl_freeaddrinfo(tsd->res);

memset(tsd,0,sizeof(*tsd));
memset(tsd, 0, sizeof(*tsd));
}

/* Initialize resolver thread synchronization data */
Expand Down
32 changes: 32 additions & 0 deletions lib/checksrc.pl
Expand Up @@ -154,6 +154,38 @@ sub scanfile {
"return without space before paren");
}
}

# check for comma without space
if($l =~ /^(.*),[^ \n]/) {
my $pref=$1;
my $ign=0;
if($pref =~ / *\#/) {
# this is a #if, treat it differently
$ign=1;
}
elsif($pref =~ /\/\*/) {
# this is a comment
$ign=1;
}
elsif($pref =~ /[\"\']/) {
$ign = 1;
# There is a quote here, figure out whether the comma is
# within a string or '' or not.
if($pref =~ /\"/) {
# withing a string
}
elsif($pref =~ /\'$/) {
# a single letter
}
else {
$ign = 0;
}
}
if(!$ign) {
checkwarn($line, length($pref)+1, $file, $l,
"comma without following space");
}
}

# check for "} else"
if($l =~ /^(.*)\} *else/) {
Expand Down
4 changes: 2 additions & 2 deletions lib/connect.c
Expand Up @@ -883,7 +883,7 @@ static void tcpnodelay(struct connectdata *conn,
infof(data, "Could not set TCP_NODELAY: %s\n",
Curl_strerror(conn, SOCKERRNO));
else
infof(data,"TCP_NODELAY set\n");
infof(data, "TCP_NODELAY set\n");
#else
(void)conn;
(void)sockfd;
Expand Down Expand Up @@ -1111,7 +1111,7 @@ static CURLcode singleipconnect(struct connectdata *conn,
default:
/* unknown error, fallthrough and try another address! */
infof(data, "Immediate connect fail for %s: %s\n",
ipaddress, Curl_strerror(conn,error));
ipaddress, Curl_strerror(conn, error));
data->state.os_errno = error;

/* connect failed */
Expand Down
2 changes: 1 addition & 1 deletion lib/curl_rtmp.c
Expand Up @@ -197,7 +197,7 @@ static CURLcode rtmp_setup_connection(struct connectdata *conn)
static CURLcode rtmp_connect(struct connectdata *conn, bool *done)
{
RTMP *r = conn->proto.generic;
SET_RCVTIMEO(tv,10);
SET_RCVTIMEO(tv, 10);

r->m_sb.sb_socket = conn->sock[FIRSTSOCKET];

Expand Down
8 changes: 4 additions & 4 deletions lib/ftp.c
Expand Up @@ -1491,13 +1491,13 @@ static CURLcode ftp_state_list(struct connectdata *conn)
The other ftp_filemethods will CWD into dir/dir/ first and
then just do LIST (in that case: nothing to do here)
*/
char *cmd,*lstArg,*slashPos;
char *cmd, *lstArg, *slashPos;

lstArg = NULL;
if((data->set.ftp_filemethod == FTPFILE_NOCWD) &&
data->state.path &&
data->state.path[0] &&
strchr(data->state.path,'/')) {
strchr(data->state.path, '/')) {

lstArg = strdup(data->state.path);
if(!lstArg)
Expand All @@ -1507,7 +1507,7 @@ static CURLcode ftp_state_list(struct connectdata *conn)
if(lstArg[strlen(lstArg) - 1] != '/') {

/* chop off the file part if format is dir/dir/file */
slashPos = strrchr(lstArg,'/');
slashPos = strrchr(lstArg, '/');
if(slashPos)
*(slashPos+1) = '\0';
}
Expand Down Expand Up @@ -3310,7 +3310,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
/* shut down the socket to inform the server we're done */

#ifdef _WIN32_WCE
shutdown(conn->sock[SECONDARYSOCKET],2); /* SD_BOTH */
shutdown(conn->sock[SECONDARYSOCKET], 2); /* SD_BOTH */
#endif

if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {
Expand Down
2 changes: 1 addition & 1 deletion lib/hostip.c
Expand Up @@ -297,7 +297,7 @@ remove_entry_if_stale(struct SessionHandle *data, struct Curl_dns_entry *dns)
time(&user.now);
user.cache_timeout = data->set.dns_cache_timeout;

if(!hostcache_timestamp_remove(&user,dns) )
if(!hostcache_timestamp_remove(&user, dns) )
return 0;

Curl_hash_clean_with_criterium(data->dns.hostcache,
Expand Down
4 changes: 2 additions & 2 deletions lib/inet_ntop.h
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, 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
Expand All @@ -31,7 +31,7 @@ char *Curl_inet_ntop(int af, const void *addr, char *buf, size_t size);
#include <arpa/inet.h>
#endif
#define Curl_inet_ntop(af,addr,buf,size) \
inet_ntop(af,addr,buf,(curl_socklen_t)size)
inet_ntop(af, addr, buf, (curl_socklen_t)size)
#endif

#endif /* HEADER_CURL_INET_NTOP_H */
Expand Down
6 changes: 4 additions & 2 deletions lib/krb5.c
Expand Up @@ -246,7 +246,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
result = Curl_base64_encode(data, (char *)output_buffer.value,
output_buffer.length, &p, &base64_sz);
if(result) {
Curl_infof(data,"base64-encoding: %s\n", curl_easy_strerror(result));
Curl_infof(data, "base64-encoding: %s\n",
curl_easy_strerror(result));
ret = AUTH_CONTINUE;
break;
}
Expand Down Expand Up @@ -278,7 +279,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
(unsigned char **)&_gssresp.value,
&_gssresp.length);
if(result) {
Curl_failf(data,"base64-decoding: %s", curl_easy_strerror(result));
Curl_failf(data, "base64-decoding: %s",
curl_easy_strerror(result));
ret = AUTH_CONTINUE;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ldap.c
Expand Up @@ -198,7 +198,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
size_t val_b64_sz = 0;
curl_off_t dlsize = 0;
#ifdef LDAP_OPT_NETWORK_TIMEOUT
struct timeval ldap_timeout = {10,0}; /* 10 sec connection/search timeout */
struct timeval ldap_timeout = {10, 0}; /* 10 sec connection/search timeout */
#endif
#if defined(USE_WIN32_LDAP)
TCHAR *host = NULL;
Expand Down
16 changes: 8 additions & 8 deletions lib/memdebug.h
Expand Up @@ -104,13 +104,13 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
#endif

#define socket(domain,type,protocol)\
curl_socket(domain,type,protocol,__LINE__,__FILE__)
curl_socket(domain, type, protocol, __LINE__, __FILE__)
#undef accept /* for those with accept as a macro */
#define accept(sock,addr,len)\
curl_accept(sock,addr,len,__LINE__,__FILE__)
curl_accept(sock, addr, len, __LINE__, __FILE__)
#ifdef HAVE_SOCKETPAIR
#define socketpair(domain,type,protocol,socket_vector)\
curl_socketpair(domain,type,protocol,socket_vector,__LINE__,__FILE__)
curl_socketpair(domain, type, protocol, socket_vector, __LINE__, __FILE__)
#endif

#ifdef HAVE_GETADDRINFO
Expand All @@ -119,25 +119,25 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
our macro as for other platforms. Instead, we redefine the new name they
define getaddrinfo to become! */
#define ogetaddrinfo(host,serv,hint,res) \
curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__)
curl_dogetaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
#else
#undef getaddrinfo
#define getaddrinfo(host,serv,hint,res) \
curl_dogetaddrinfo(host,serv,hint,res,__LINE__,__FILE__)
curl_dogetaddrinfo(host, serv, hint, res, __LINE__, __FILE__)
#endif
#endif /* HAVE_GETADDRINFO */

#ifdef HAVE_GETNAMEINFO
#undef getnameinfo
#define getnameinfo(sa,salen,host,hostlen,serv,servlen,flags) \
curl_dogetnameinfo(sa,salen,host,hostlen,serv,servlen,flags, __LINE__, \
__FILE__)
curl_dogetnameinfo(sa, salen, host, hostlen, serv, servlen, flags, \
__LINE__, __FILE__)
#endif /* HAVE_GETNAMEINFO */

#ifdef HAVE_FREEADDRINFO
#undef freeaddrinfo
#define freeaddrinfo(data) \
curl_dofreeaddrinfo(data,__LINE__,__FILE__)
curl_dofreeaddrinfo(data, __LINE__, __FILE__)
#endif /* HAVE_FREEADDRINFO */

/* sclose is probably already defined, redefine it! */
Expand Down
4 changes: 2 additions & 2 deletions lib/multi.c
Expand Up @@ -2426,7 +2426,7 @@ CURLMcode curl_multi_socket_all(CURLM *multi_handle, int *running_handles)
static CURLMcode multi_timeout(struct Curl_multi *multi,
long *timeout_ms)
{
static struct timeval tv_zero = {0,0};
static struct timeval tv_zero = {0, 0};

if(multi->timetree) {
/* we have a tree of expire times */
Expand Down Expand Up @@ -2484,7 +2484,7 @@ static int update_timer(struct Curl_multi *multi)
return -1;
}
if(timeout_ms < 0) {
static const struct timeval none={0,0};
static const struct timeval none={0, 0};
if(Curl_splaycomparekeys(none, multi->timer_lastcall)) {
multi->timer_lastcall = none;
/* there's no timeout now but there was one previously, tell the app to
Expand Down
6 changes: 3 additions & 3 deletions lib/openldap.c
Expand Up @@ -227,7 +227,7 @@ static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
ldapconninfo *li = conn->proto.generic;
struct SessionHandle *data = conn->data;
LDAPMessage *msg = NULL;
struct timeval tv = {0,1}, *tvp;
struct timeval tv = {0, 1}, *tvp;
int rc, err;
char *info = NULL;

Expand Down Expand Up @@ -378,7 +378,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done)
failf(data, "LDAP local: ldap_search_ext %s", ldap_err2string(rc));
return CURLE_LDAP_SEARCH_FAILED;
}
lr = calloc(1,sizeof(ldapreqinfo));
lr = calloc(1, sizeof(ldapreqinfo));
if(!lr)
return CURLE_OUT_OF_MEMORY;
lr->msgid = msgid;
Expand Down Expand Up @@ -420,7 +420,7 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
LDAPMessage *msg = NULL;
LDAPMessage *ent;
BerElement *ber = NULL;
struct timeval tv = {0,1};
struct timeval tv = {0, 1};

(void)len;
(void)buf;
Expand Down
4 changes: 2 additions & 2 deletions lib/select.c
Expand Up @@ -159,7 +159,7 @@ int Curl_socket_check(curl_socket_t readfd0, /* two sockets to read from */
fd_set fds_err;
curl_socket_t maxfd;
#endif
struct timeval initial_tv = {0,0};
struct timeval initial_tv = {0, 0};
int pending_ms = 0;
int error;
int r;
Expand Down Expand Up @@ -393,7 +393,7 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms)
fd_set fds_err;
curl_socket_t maxfd;
#endif
struct timeval initial_tv = {0,0};
struct timeval initial_tv = {0, 0};
bool fds_none = TRUE;
unsigned int i;
int pending_ms = 0;
Expand Down
4 changes: 2 additions & 2 deletions lib/setup-vms.h
Expand Up @@ -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
Expand Down Expand Up @@ -414,7 +414,7 @@ char * unix_path;

static void des_ecb_encrypt(const_des_cblock *input,
des_cblock *output,
des_key_schedule ks,int enc) {
des_key_schedule ks, int enc) {
DES_ECB_ENCRYPT(input, output, ks, enc);
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions lib/socks.c
Expand Up @@ -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
Expand Down Expand Up @@ -382,7 +382,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,

/* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
if(!socks5_resolve_local && hostname_len > 255) {
infof(conn->data,"SOCKS5: server resolving disabled for hostnames of "
infof(conn->data, "SOCKS5: server resolving disabled for hostnames of "
"length > 255 [actual len=%zu]\n", hostname_len);
socks5_resolve_local = TRUE;
}
Expand Down

0 comments on commit 9395999

Please sign in to comment.