Skip to content

Commit

Permalink
checksrc: stricter no-space-before-paren enforcement
Browse files Browse the repository at this point in the history
In order to make the code style more uniform everywhere
  • Loading branch information
bagder committed Dec 13, 2016
1 parent 5fad800 commit b228d29
Show file tree
Hide file tree
Showing 81 changed files with 281 additions and 260 deletions.
8 changes: 4 additions & 4 deletions docs/examples/curlx.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ int main(int argc, char **argv)
binaryptr = malloc(tabLength);

p.verbose = 0;
p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
p.errorbio = BIO_new_fp(stderr, BIO_NOCLOSE);

curl_global_init(CURL_GLOBAL_DEFAULT);

Expand Down Expand Up @@ -408,7 +408,7 @@ int main(int argc, char **argv)
}


p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
p.errorbio = BIO_new_fp(stderr, BIO_NOCLOSE);

if(!(p.curl = curl_easy_init())) {
BIO_printf(p.errorbio, "Cannot init curl lib\n");
Expand All @@ -419,7 +419,7 @@ int main(int argc, char **argv)
BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file);
goto err;
}
if(!(p.p12 = d2i_PKCS12_bio (p12bio, NULL))) {
if(!(p.p12 = d2i_PKCS12_bio(p12bio, NULL))) {
BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file);
goto err;
}
Expand Down Expand Up @@ -505,7 +505,7 @@ int main(int argc, char **argv)

{
int lu; int i=0;
while((lu = BIO_read (in, &binaryptr[i], tabLength-i)) >0) {
while((lu = BIO_read(in, &binaryptr[i], tabLength-i)) >0) {
i+=lu;
if(i== tabLength) {
tabLength+=100;
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int my_trace(CURL *handle, curl_infotype type,
const char *text;
(void)handle; /* prevent compiler warning */

switch (type) {
switch(type) {
case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", data);
default: /* in case a new one is introduced to shock us */
Expand Down
14 changes: 7 additions & 7 deletions docs/examples/evhiperfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static void mcode_or_die(const char *where, CURLMcode code)
{
if(CURLM_OK != code) {
const char *s;
switch (code) {
switch(code) {
case CURLM_BAD_HANDLE:
s="CURLM_BAD_HANDLE";
break;
Expand Down Expand Up @@ -317,8 +317,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)


/* CURLOPT_PROGRESSFUNCTION */
static int prog_cb (void *p, double dltotal, double dlnow, double ult,
double uln)
static int prog_cb(void *p, double dltotal, double dlnow, double ult,
double uln)
{
ConnInfo *conn = (ConnInfo *)p;
(void)ult;
Expand Down Expand Up @@ -388,7 +388,7 @@ static void fifo_cb(EV_P_ struct ev_io *w, int revents)
}

/* Create a named pipe and tell libevent to monitor it */
static int init_fifo (GlobalInfo *g)
static int init_fifo(GlobalInfo *g)
{
struct stat st;
static const char *fifo = "hiper.fifo";
Expand All @@ -399,18 +399,18 @@ static int init_fifo (GlobalInfo *g)
if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST;
perror("lstat");
exit (1);
exit(1);
}
}
unlink(fifo);
if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo");
exit (1);
exit(1);
}
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) {
perror("open");
exit (1);
exit(1);
}
g->input = fdopen(sockfd, "r");

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ftpupload.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ int main(void)
curl_easy_strerror(res));

/* clean up the FTP commands list */
curl_slist_free_all (headerlist);
curl_slist_free_all(headerlist);

/* always cleanup */
curl_easy_cleanup(curl);
Expand Down
18 changes: 9 additions & 9 deletions docs/examples/ghiper.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void mcode_or_die(const char *where, CURLMcode code)
{
if(CURLM_OK != code) {
const char *s;
switch (code) {
switch(code) {
case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break;
case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break;
case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break;
Expand Down Expand Up @@ -272,8 +272,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)
}

/* CURLOPT_PROGRESSFUNCTION */
static int prog_cb (void *p, double dltotal, double dlnow, double ult,
double uln)
static int prog_cb(void *p, double dltotal, double dlnow, double ult,
double uln)
{
ConnInfo *conn = (ConnInfo *)p;
MSG_OUT("Progress: %s (%g/%g)\n", conn->url, dlnow, dltotal);
Expand Down Expand Up @@ -318,7 +318,7 @@ static void new_conn(char *url, GlobalInfo *g)
}

/* This gets called by glib whenever data is received from the fifo */
static gboolean fifo_cb (GIOChannel *ch, GIOCondition condition, gpointer data)
static gboolean fifo_cb(GIOChannel *ch, GIOCondition condition, gpointer data)
{
#define BUF_SIZE 1024
gsize len, tp;
Expand Down Expand Up @@ -380,21 +380,21 @@ int init_fifo(void)
if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST;
perror("lstat");
exit (1);
exit(1);
}
}

unlink (fifo);
unlink(fifo);
if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo");
exit (1);
exit(1);
}

socket = open (fifo, O_RDWR | O_NONBLOCK, 0);
socket = open(fifo, O_RDWR | O_NONBLOCK, 0);

if(socket == -1) {
perror("open");
exit (1);
exit(1);
}
MSG_OUT("Now, pipe some URL's into > %s\n", fifo);

Expand Down
14 changes: 7 additions & 7 deletions docs/examples/hiperfifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static void mcode_or_die(const char *where, CURLMcode code)
{
if(CURLM_OK != code) {
const char *s;
switch (code) {
switch(code) {
case CURLM_BAD_HANDLE: s="CURLM_BAD_HANDLE"; break;
case CURLM_BAD_EASY_HANDLE: s="CURLM_BAD_EASY_HANDLE"; break;
case CURLM_OUT_OF_MEMORY: s="CURLM_OUT_OF_MEMORY"; break;
Expand Down Expand Up @@ -300,8 +300,8 @@ static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data)


/* CURLOPT_PROGRESSFUNCTION */
static int prog_cb (void *p, double dltotal, double dlnow, double ult,
double uln)
static int prog_cb(void *p, double dltotal, double dlnow, double ult,
double uln)
{
ConnInfo *conn = (ConnInfo *)p;
(void)ult;
Expand Down Expand Up @@ -371,7 +371,7 @@ static void fifo_cb(int fd, short event, void *arg)

/* Create a named pipe and tell libevent to monitor it */
static const char *fifo = "hiper.fifo";
static int init_fifo (GlobalInfo *g)
static int init_fifo(GlobalInfo *g)
{
struct stat st;
curl_socket_t sockfd;
Expand All @@ -381,18 +381,18 @@ static int init_fifo (GlobalInfo *g)
if((st.st_mode & S_IFMT) == S_IFREG) {
errno = EEXIST;
perror("lstat");
exit (1);
exit(1);
}
}
unlink(fifo);
if(mkfifo (fifo, 0600) == -1) {
perror("mkfifo");
exit (1);
exit(1);
}
sockfd = open(fifo, O_RDWR | O_NONBLOCK, 0);
if(sockfd == -1) {
perror("open");
exit (1);
exit(1);
}
g->input = fdopen(sockfd, "r");

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/http2-download.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int my_trace(CURL *handle, curl_infotype type,
int num = hnd2num(handle);
(void)handle; /* prevent compiler warning */
(void)userp;
switch (type) {
switch(type) {
case CURLINFO_TEXT:
fprintf(stderr, "== %d Info: %s", num, data);
default: /* in case a new one is introduced to shock us */
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/http2-serverpush.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ int my_trace(CURL *handle, curl_infotype type,
const char *text;
(void)handle; /* prevent compiler warning */
(void)userp;
switch (type) {
switch(type) {
case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", data);
default: /* in case a new one is introduced to shock us */
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/http2-upload.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ int my_trace(CURL *handle, curl_infotype type,
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d.%06ld",
now->tm_hour, now->tm_min, now->tm_sec, (long)tv.tv_usec);

switch (type) {
switch(type) {
case CURLINFO_TEXT:
fprintf(stderr, "%s [%d] Info: %s", timebuf, num, data);
default: /* in case a new one is introduced to shock us */
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/multi-app.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int main(void)
break;
}

switch (idx) {
switch(idx) {
case HTTP_HANDLE:
printf("HTTP transfer completed with status %d\n", msg->data.result);
break;
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/multi-debugcallback.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int my_trace(CURL *handle, curl_infotype type,
(void)userp;
(void)handle; /* prevent compiler warning */

switch (type) {
switch(type) {
case CURLINFO_TEXT:
fprintf(stderr, "== Info: %s", data);
default: /* in case a new one is introduced to shock us */
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/multi-post.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ int main(void)
curl_formfree(formpost);

/* free slist */
curl_slist_free_all (headerlist);
curl_slist_free_all(headerlist);
}
return 0;
}
2 changes: 1 addition & 1 deletion docs/examples/postit2.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int main(int argc, char *argv[])
/* then cleanup the formpost chain */
curl_formfree(formpost);
/* free slist */
curl_slist_free_all (headerlist);
curl_slist_free_all(headerlist);
}
return 0;
}
12 changes: 6 additions & 6 deletions docs/examples/smooth-gtk-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void *pull_one_url(void *NaN)

curl_easy_cleanup(curl);
}
g_free (http);
g_free(http);

/* Adds more latency, testing the mutex.*/
sleep(1);
Expand All @@ -118,7 +118,7 @@ void *pull_one_url(void *NaN)
gboolean pulse_bar(gpointer data)
{
gdk_threads_enter();
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (data));
gtk_progress_bar_pulse(GTK_PROGRESS_BAR (data));
gdk_threads_leave();

/* Return true so the function will be called again;
Expand Down Expand Up @@ -182,8 +182,8 @@ int main(int argc, char **argv)

/* Init thread */
g_thread_init(NULL);
gdk_threads_init ();
gdk_threads_enter ();
gdk_threads_init();
gdk_threads_enter();

gtk_init(&argc, &argv);

Expand All @@ -203,9 +203,9 @@ int main(int argc, char **argv)

/* Progress bar */
progress_bar = gtk_progress_bar_new();
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (progress_bar));
gtk_progress_bar_pulse(GTK_PROGRESS_BAR (progress_bar));
/* Make uniform pulsing */
gint pulse_ref = g_timeout_add (300, pulse_bar, progress_bar);
gint pulse_ref = g_timeout_add(300, pulse_bar, progress_bar);
g_object_set_data(G_OBJECT(progress_bar), "pulse_id",
GINT_TO_POINTER(pulse_ref));
gtk_container_add(GTK_CONTAINER(inside_frame), progress_bar);
Expand Down
6 changes: 3 additions & 3 deletions docs/examples/synctime.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ size_t SyncTime_CURL_WriteHeader(void *ptr, size_t size, size_t nmemb,
TmpStr1 & 2? */
AutoSyncTime = 0;
else {
RetVal = sscanf ((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu",
TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear,
&SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond);
RetVal = sscanf((char *)(ptr), "Date: %s %hu %s %hu %hu:%hu:%hu",
TmpStr1, &SYSTime.wDay, TmpStr2, &SYSTime.wYear,
&SYSTime.wHour, &SYSTime.wMinute, &SYSTime.wSecond);

if(RetVal == 7) {
SYSTime.wMilliseconds = 500; /* adjust to midpoint, 0.5 sec */
Expand Down
5 changes: 4 additions & 1 deletion include/curl/curl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,10 @@ typedef enum {


/* curl_strequal() and curl_strnequal() are subject for removal in a future
libcurl, see lib/README.curlx for details */
libcurl, see lib/README.curlx for details
!checksrc! disable SPACEBEFOREPAREN 2
*/
CURL_EXTERN int (curl_strequal)(const char *s1, const char *s2);
CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);

Expand Down
6 changes: 3 additions & 3 deletions include/curl/stdcheaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2016, 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 @@ -24,8 +24,8 @@

#include <sys/types.h>

size_t fread (void *, size_t, size_t, FILE *);
size_t fwrite (const void *, size_t, size_t, FILE *);
size_t fread(void *, size_t, size_t, FILE *);
size_t fwrite(const void *, size_t, size_t, FILE *);

int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
Expand Down
4 changes: 2 additions & 2 deletions include/curl/typecheck-gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
#define curl_easy_setopt(handle, option, value) \
__extension__ ({ \
__typeof__ (option) _curl_opt = option; \
__typeof__(option) _curl_opt = option; \
if(__builtin_constant_p(_curl_opt)) { \
if(_curl_is_long_option(_curl_opt)) \
if(!_curl_is_long(value)) \
Expand Down Expand Up @@ -110,7 +110,7 @@ __extension__ ({ \
/* FIXME: don't allow const pointers */
#define curl_easy_getinfo(handle, info, arg) \
__extension__ ({ \
__typeof__ (info) _curl_info = info; \
__typeof__(info) _curl_info = info; \
if(__builtin_constant_p(_curl_info)) { \
if(_curl_is_string_info(_curl_info)) \
if(!_curl_is_arr((arg), char *)) \
Expand Down
4 changes: 2 additions & 2 deletions lib/asyn-ares.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ int Curl_resolver_duphandle(void **to, void *from)
return CURLE_OK;
}

static void destroy_async_data (struct Curl_async *async);
static void destroy_async_data(struct Curl_async *async);

/*
* Cancel all possibly still on-going resolves for this connection.
Expand All @@ -184,7 +184,7 @@ void Curl_resolver_cancel(struct connectdata *conn)
/*
* destroy_async_data() cleans up async resolver data.
*/
static void destroy_async_data (struct Curl_async *async)
static void destroy_async_data(struct Curl_async *async)
{
free(async->hostname);

Expand Down
Loading

0 comments on commit b228d29

Please sign in to comment.