Permalink
Browse files

whitespace cleanup: no space first in conditionals

"if(a)" is our style, not "if( a )"
  • Loading branch information...
1 parent 1b758b0 commit 889d1e973fb718a77c5000141d724ce03863af23 @bagder bagder committed Apr 22, 2011
Showing with 108 additions and 107 deletions.
  1. +11 −11 lib/asyn-ares.c
  2. +3 −3 lib/connect.c
  3. +4 −4 lib/cookie.c
  4. +6 −6 lib/easy.c
  5. +3 −3 lib/file.c
  6. +28 −28 lib/formdata.c
  7. +7 −7 lib/ftp.c
  8. +7 −7 lib/gtls.c
  9. +3 −3 lib/hostip.c
  10. +2 −2 lib/http.c
  11. +1 −1 lib/http_chunks.c
  12. +1 −1 lib/http_negotiate.c
  13. +6 −6 lib/http_negotiate_sspi.c
  14. +1 −1 lib/mprintf.c
  15. +10 −10 lib/multi.c
  16. +2 −2 lib/pop3.c
  17. +2 −2 lib/speedcheck.c
  18. +1 −1 lib/tftp.c
  19. +6 −6 lib/transfer.c
  20. +2 −2 lib/url.c
  21. +2 −1 lib/urldata.h
View
@@ -188,7 +188,7 @@ static void destroy_async_data (struct Curl_async *async);
*/
void Curl_resolver_cancel(struct connectdata *conn)
{
- if( conn && conn->data && conn->data->state.resolver )
+ if(conn && conn->data && conn->data->state.resolver)
ares_cancel((ares_channel)conn->data->state.resolver);
destroy_async_data(&conn->async);
}
@@ -203,8 +203,8 @@ static void destroy_async_data (struct Curl_async *async)
if(async->os_specific) {
struct ResolverResults *res = (struct ResolverResults *)async->os_specific;
- if( res ) {
- if( res->temp_ai ) {
+ if(res) {
+ if(res->temp_ai) {
Curl_freeaddrinfo(res->temp_ai);
res->temp_ai = NULL;
}
@@ -329,7 +329,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
waitperform(conn, 0);
- if( res && !res->num_pending ) {
+ if(res && !res->num_pending) {
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
/* temp_ai ownership is moved to the connection, so we need not free-up
them */
@@ -465,7 +465,7 @@ static void compound_results(struct ResolverResults *res,
return;
ai_tail = ai;
- while (ai_tail->ai_next)
+ while(ai_tail->ai_next)
ai_tail = ai_tail->ai_next;
/* Add the new results to the list of old results. */
@@ -507,7 +507,7 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
}
}
/* A successful result overwrites any previous error */
- if( res->last_status != ARES_SUCCESS )
+ if(res->last_status != ARES_SUCCESS)
res->last_status = status;
}
@@ -573,7 +573,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
conn->async.status = 0; /* clear */
conn->async.dns = NULL; /* clear */
res = (struct ResolverResults *)calloc(sizeof(struct ResolverResults),1);
- if( !res ) {
+ if(!res) {
Curl_safefree(conn->async.hostname);
conn->async.hostname = NULL;
return NULL;
@@ -587,10 +587,10 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
res->num_pending = 2;
/* areschannel is already setup in the Curl_open() function */
- ares_gethostbyname((ares_channel)data->state.resolver, hostname, PF_INET,
- query_completed_cb, conn);
- ares_gethostbyname((ares_channel)data->state.resolver, hostname, PF_INET6,
- query_completed_cb, conn);
+ ares_gethostbyname((ares_channel)data->state.resolver, hostname,
+ PF_INET, query_completed_cb, conn);
+ ares_gethostbyname((ares_channel)data->state.resolver, hostname,
+ PF_INET6, query_completed_cb, conn);
}
else
#endif /* CURLRES_IPV6 */
View
@@ -372,22 +372,22 @@ static CURLcode bindlocal(struct connectdata *conn,
else {
/* no device was given, prepare sa to match af's needs */
#ifdef ENABLE_IPV6
- if( af == AF_INET6 ) {
+ if(af == AF_INET6) {
si6->sin6_family = AF_INET6;
si6->sin6_port = htons(port);
sizeof_sa = sizeof(struct sockaddr_in6);
}
else
#endif
- if( af == AF_INET ) {
+ if(af == AF_INET) {
si4->sin_family = AF_INET;
si4->sin_port = htons(port);
sizeof_sa = sizeof(struct sockaddr_in);
}
}
for(;;) {
- if( bind(sockfd, sock, sizeof_sa) >= 0) {
+ if(bind(sockfd, sock, sizeof_sa) >= 0) {
/* we succeeded to bind */
struct Curl_sockaddr_storage add;
curl_socklen_t size = sizeof(add);
View
@@ -373,8 +373,8 @@ Curl_cookie_add(struct SessionHandle *data,
non-session cookie */
if(co->expires == 0)
co->expires = 1;
- else if( co->expires < 0 )
- co->expires = 0;
+ else if(co->expires < 0)
+ co->expires = 0;
}
else if(!co->name) {
co->name = strdup(name);
@@ -819,8 +819,8 @@ struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
/* only process this cookie if it is not expired or had no expire
date AND that if the cookie requires we're secure we must only
continue if we are! */
- if( (!co->expires || (co->expires > now)) &&
- (co->secure?secure:TRUE) ) {
+ if((!co->expires || (co->expires > now)) &&
+ (co->secure?secure:TRUE)) {
/* now check if the domain is correct */
if(!co->domain ||
View
@@ -133,8 +133,8 @@ static CURLcode win32_init(void)
/* wVersionRequested in wVersion. wHighVersion contains the */
/* highest supported version. */
- if( LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) ||
- HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) {
+ if(LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) ||
+ HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) {
/* Tell the user that we couldn't find a useable */
/* winsock.dll. */
@@ -305,7 +305,7 @@ CURLcode curl_global_init_mem(long flags, curl_malloc_callback m,
return CURLE_FAILED_INIT;
/* Already initialized, don't do it again */
- if( initialized )
+ if(initialized)
return CURLE_OK;
/* Call the actual init function first */
@@ -506,7 +506,7 @@ CURLcode curl_easy_perform(CURL *curl)
if(!data)
return CURLE_BAD_FUNCTION_ARGUMENT;
- if( ! (data->share && data->share->hostcache) ) {
+ if(! (data->share && data->share->hostcache)) {
/* this handle is not using a shared dns cache */
if(data->set.global_dns_cache &&
@@ -673,8 +673,8 @@ CURL *curl_easy_duphandle(CURL *incurl)
}
/* Clone the resolver handle, if present, for the new handle */
- if( Curl_resolver_duphandle(&outcurl->state.resolver,
- data->state.resolver) != CURLE_OK )
+ if(Curl_resolver_duphandle(&outcurl->state.resolver,
+ data->state.resolver) != CURLE_OK)
goto fail;
Curl_convert_setup(outcurl);
View
@@ -377,7 +377,7 @@ static CURLcode file_upload(struct connectdata *conn)
/*skip bytes before resume point*/
if(data->state.resume_from) {
- if( (curl_off_t)nread <= data->state.resume_from ) {
+ if((curl_off_t)nread <= data->state.resume_from ) {
data->state.resume_from -= nread;
nread = 0;
buf2 = buf;
@@ -456,7 +456,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
fd = conn->data->state.proto.file->fd;
/* VMS: This only works reliable for STREAMLF files */
- if( -1 != fstat(fd, &statbuf)) {
+ if(-1 != fstat(fd, &statbuf)) {
/* we could stat it, then read out the size */
expected_size = statbuf.st_size;
/* and store the modification time */
@@ -562,7 +562,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
bytestoread = (expected_size < BUFSIZE-1)?(size_t)expected_size:BUFSIZE-1;
nread = read(fd, buf, bytestoread);
- if( nread > 0)
+ if(nread > 0)
buf[nread] = 0;
if(nread <= 0 || expected_size == 0)
View
@@ -341,7 +341,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
while(return_value == CURL_FORMADD_OK) {
/* first see if we have more parts of the array param */
- if( array_state && forms ) {
+ if(array_state && forms) {
/* get the upcoming option from the given array */
option = forms->option;
array_value = (char *)forms->value;
@@ -598,7 +598,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
(struct curl_slist*)array_value:
va_arg(params, struct curl_slist*);
- if( current_form->contentheader )
+ if(current_form->contentheader)
return_value = CURL_FORMADD_OPTION_TWICE;
else
current_form->contentheader = list;
@@ -609,7 +609,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
{
const char *filename = array_state?array_value:
va_arg(params, char *);
- if( current_form->showfilename )
+ if(current_form->showfilename)
return_value = CURL_FORMADD_OPTION_TWICE;
else {
current_form->showfilename = strdup(filename);
@@ -633,26 +633,26 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
for(form = first_form;
form != NULL;
form = form->more) {
- if( ((!form->name || !form->value) && !post) ||
- ( (form->contentslength) &&
- (form->flags & HTTPPOST_FILENAME) ) ||
- ( (form->flags & HTTPPOST_FILENAME) &&
- (form->flags & HTTPPOST_PTRCONTENTS) ) ||
-
- ( (!form->buffer) &&
- (form->flags & HTTPPOST_BUFFER) &&
- (form->flags & HTTPPOST_PTRBUFFER) ) ||
-
- ( (form->flags & HTTPPOST_READFILE) &&
- (form->flags & HTTPPOST_PTRCONTENTS) )
+ if(((!form->name || !form->value) && !post) ||
+ ( (form->contentslength) &&
+ (form->flags & HTTPPOST_FILENAME) ) ||
+ ( (form->flags & HTTPPOST_FILENAME) &&
+ (form->flags & HTTPPOST_PTRCONTENTS) ) ||
+
+ ( (!form->buffer) &&
+ (form->flags & HTTPPOST_BUFFER) &&
+ (form->flags & HTTPPOST_PTRBUFFER) ) ||
+
+ ( (form->flags & HTTPPOST_READFILE) &&
+ (form->flags & HTTPPOST_PTRCONTENTS) )
) {
return_value = CURL_FORMADD_INCOMPLETE;
break;
}
else {
- if( ((form->flags & HTTPPOST_FILENAME) ||
- (form->flags & HTTPPOST_BUFFER)) &&
- !form->contenttype ) {
+ if(((form->flags & HTTPPOST_FILENAME) ||
+ (form->flags & HTTPPOST_BUFFER)) &&
+ !form->contenttype ) {
/* our contenttype is missing */
form->contenttype
= strdup(ContentTypeForFilename(form->value, prevtype));
@@ -662,8 +662,8 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
}
form->contenttype_alloc = TRUE;
}
- if( !(form->flags & HTTPPOST_PTRNAME) &&
- (form == first_form) ) {
+ if(!(form->flags & HTTPPOST_PTRNAME) &&
+ (form == first_form) ) {
/* Note that there's small risk that form->name is NULL here if the
app passed in a bad combo, so we better check for that first. */
if(form->name)
@@ -675,9 +675,9 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
}
form->name_alloc = TRUE;
}
- if( !(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
- HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |
- HTTPPOST_CALLBACK)) ) {
+ if(!(form->flags & (HTTPPOST_FILENAME | HTTPPOST_READFILE |
+ HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER |
+ HTTPPOST_CALLBACK)) ) {
/* copy value (without strdup; possibly contains null characters) */
form->value = memdup(form->value, form->contentslength);
if(!form->value) {
@@ -919,10 +919,10 @@ void curl_formfree(struct curl_httppost *form)
if(form->more)
curl_formfree(form->more);
- if( !(form->flags & HTTPPOST_PTRNAME) && form->name)
+ if(!(form->flags & HTTPPOST_PTRNAME) && form->name)
free(form->name); /* free the name */
- if( !(form->flags & (HTTPPOST_PTRCONTENTS|HTTPPOST_CALLBACK)) &&
- form->contents)
+ if(!(form->flags & (HTTPPOST_PTRCONTENTS|HTTPPOST_CALLBACK)) &&
+ form->contents)
free(form->contents); /* free the contents */
if(form->contenttype)
free(form->contenttype); /* free the content type */
@@ -1154,7 +1154,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data,
}
curList = file->contentheader;
- while( curList ) {
+ while(curList) {
/* Process the additional headers specified for this form */
result = AddFormDataf( &form, &size, "\r\n%s", curList->data );
if(result)
@@ -1350,7 +1350,7 @@ size_t Curl_FormReader(char *buffer,
}
do {
- if( (form->data->length - form->sent ) > wantedsize - gotsize) {
+ if((form->data->length - form->sent ) > wantedsize - gotsize) {
memcpy(buffer + gotsize , form->data->line + form->sent,
wantedsize - gotsize);
View
@@ -753,11 +753,11 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
}
else
#endif
- if( *string_ftpport == ':') {
+ if(*string_ftpport == ':') {
/* :port */
ip_end = string_ftpport;
}
- else if( (ip_end = strchr(string_ftpport, ':')) != NULL) {
+ else if((ip_end = strchr(string_ftpport, ':')) != NULL) {
/* either ipv6 or (ipv4|domain|interface):port(-range) */
#ifdef ENABLE_IPV6
if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) {
@@ -776,7 +776,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
strcpy(addr, string_ftpport);
/* parse the port */
- if( ip_end != NULL ) {
+ if(ip_end != NULL) {
if((port_start = strchr(ip_end, ':')) != NULL) {
port_min = curlx_ultous(strtoul(port_start+1, NULL, 10));
if((port_sep = strchr(port_start, '-')) != NULL) {
@@ -884,8 +884,8 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
memcpy(sa, ai->ai_addr, ai->ai_addrlen);
sslen = ai->ai_addrlen;
- for( port = port_min; port <= port_max; ) {
- if( sa->sa_family == AF_INET )
+ for(port = port_min; port <= port_max;) {
+ if(sa->sa_family == AF_INET)
sa4->sin_port = htons(port);
#ifdef ENABLE_IPV6
else
@@ -2112,7 +2112,7 @@ static CURLcode ftp_state_stor_resp(struct connectdata *conn,
/* BLOCKING */
/* PORT means we are now awaiting the server to connect to us. */
result = AllowServerConnect(conn);
- if( result )
+ if(result)
return result;
}
@@ -2226,7 +2226,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
if(data->set.ftp_use_port) {
/* BLOCKING */
result = AllowServerConnect(conn);
- if( result )
+ if(result)
return result;
}
View
@@ -443,13 +443,13 @@ gtls_connect_step1(struct connectdata *conn,
return CURLE_SSL_CONNECT_ERROR;
if(data->set.str[STRING_CERT]) {
- if( gnutls_certificate_set_x509_key_file(
- conn->ssl[sockindex].cred,
- data->set.str[STRING_CERT],
- data->set.str[STRING_KEY] ?
- data->set.str[STRING_KEY] : data->set.str[STRING_CERT],
- do_file_type(data->set.str[STRING_CERT_TYPE]) ) !=
- GNUTLS_E_SUCCESS) {
+ if(gnutls_certificate_set_x509_key_file(
+ conn->ssl[sockindex].cred,
+ data->set.str[STRING_CERT],
+ data->set.str[STRING_KEY] ?
+ data->set.str[STRING_KEY] : data->set.str[STRING_CERT],
+ do_file_type(data->set.str[STRING_CERT_TYPE]) ) !=
+ GNUTLS_E_SUCCESS) {
failf(data, "error reading X.509 key or certificate file");
return CURLE_SSL_CONNECT_ERROR;
}
Oops, something went wrong.

0 comments on commit 889d1e9

Please sign in to comment.