From 66b077576313eda129bce9f58fdc894d857cb121 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 13 May 2020 12:56:53 +0200 Subject: checksrc: enhance the ASTERISKSPACE and update code accordingly Fine: "struct hello *world" Not fine: "struct hello* world" (and variations) Closes #5386 --- docs/examples/multi-event.c | 4 ++-- docs/examples/multi-uv.c | 4 ++-- lib/asyn-thread.c | 6 +++--- lib/checksrc.pl | 6 +++--- lib/curl_threads.c | 4 ++-- lib/ftp.c | 2 +- lib/mime.c | 2 +- lib/select.h | 2 +- lib/setup-os400.h | 8 ++++---- lib/setup-vms.h | 6 +++--- lib/socks_gssapi.c | 2 +- lib/tftp.c | 4 ++-- lib/url.c | 10 +++++----- lib/url.h | 2 +- lib/vtls/mbedtls.c | 4 ++-- lib/vtls/vtls.c | 6 +++--- lib/vtls/vtls.h | 6 +++--- lib/vtls/wolfssl.c | 6 +++--- lib/x509asn1.c | 4 ++-- src/tool_cfgable.c | 4 ++-- tests/libtest/lib582.c | 12 ++++++------ tests/unit/unit1309.c | 4 ++-- tests/unit/unit1608.c | 4 ++-- 23 files changed, 56 insertions(+), 56 deletions(-) diff --git a/docs/examples/multi-event.c b/docs/examples/multi-event.c index 482de8e7f..34bb0d645 100644 --- a/docs/examples/multi-event.c +++ b/docs/examples/multi-event.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -41,7 +41,7 @@ typedef struct curl_context_s { static void curl_perform(int fd, short event, void *arg); -static curl_context_t* create_curl_context(curl_socket_t sockfd) +static curl_context_t *create_curl_context(curl_socket_t sockfd) { curl_context_t *context; diff --git a/docs/examples/multi-uv.c b/docs/examples/multi-uv.c index 8ca4b9096..1b4a75252 100644 --- a/docs/examples/multi-uv.c +++ b/docs/examples/multi-uv.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -46,7 +46,7 @@ typedef struct curl_context_s { curl_socket_t sockfd; } curl_context_t; -static curl_context_t* create_curl_context(curl_socket_t sockfd) +static curl_context_t *create_curl_context(curl_socket_t sockfd) { curl_context_t *context; diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c index 2138eb5cf..95bd23409 100644 --- a/lib/asyn-thread.c +++ b/lib/asyn-thread.c @@ -158,7 +158,7 @@ static bool init_resolve_thread(struct connectdata *conn, /* Data for synchronization between resolver thread and its parent */ struct thread_sync_data { - curl_mutex_t * mtx; + curl_mutex_t *mtx; int done; char *hostname; /* hostname to resolve, Curl_async.hostname @@ -190,7 +190,7 @@ static struct thread_sync_data *conn_thread_sync_data(struct connectdata *conn) /* Destroy resolver thread synchronization data */ static -void destroy_thread_sync_data(struct thread_sync_data * tsd) +void destroy_thread_sync_data(struct thread_sync_data *tsd) { if(tsd->mtx) { Curl_mutex_destroy(tsd->mtx); @@ -216,7 +216,7 @@ void destroy_thread_sync_data(struct thread_sync_data * tsd) /* Initialize resolver thread synchronization data */ static -int init_thread_sync_data(struct thread_data * td, +int init_thread_sync_data(struct thread_data *td, const char *hostname, int port, const struct addrinfo *hints) diff --git a/lib/checksrc.pl b/lib/checksrc.pl index df93696d7..cbd204adb 100755 --- a/lib/checksrc.pl +++ b/lib/checksrc.pl @@ -640,10 +640,10 @@ sub scanfile { } # check for 'char * name' - if(($l =~ /(^.*(char|int|long|void|curl_slist|CURL|CURLM|CURLMsg|curl_httppost) *(\*+)) (\w+)/) && ($4 ne "const")) { - checkwarn("ASTERISKNOSPACE", + if(($l =~ /(^.*(char|int|long|void|CURL|CURLM|CURLMsg|[cC]url_[A-Za-z_]+|struct [a-zA-Z_]+) *(\*+)) (\w+)/) && ($4 !~ /^(const|volatile)$/)) { + checkwarn("ASTERISKSPACE", $line, length($1), $file, $ol, - "no space after declarative asterisk"); + "space after declarative asterisk"); } # check for 'char*' if(($l =~ /(^.*(char|int|long|void|curl_slist|CURL|CURLM|CURLMsg|curl_httppost|sockaddr_in|FILE)\*)/)) { diff --git a/lib/curl_threads.c b/lib/curl_threads.c index 064c075d0..b5f10a20e 100644 --- a/lib/curl_threads.c +++ b/lib/curl_threads.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -48,7 +48,7 @@ struct curl_actual_call { static void *curl_thread_create_thunk(void *arg) { - struct curl_actual_call * ac = arg; + struct curl_actual_call *ac = arg; unsigned int (*func)(void *) = ac->func; void *real_arg = ac->arg; diff --git a/lib/ftp.c b/lib/ftp.c index 57b22ade9..3b0f03b81 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -136,7 +136,7 @@ static int ftp_getsock(struct connectdata *conn, curl_socket_t *socks); static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks); static CURLcode ftp_doing(struct connectdata *conn, bool *dophase_done); -static CURLcode ftp_setup_connection(struct connectdata * conn); +static CURLcode ftp_setup_connection(struct connectdata *conn); static CURLcode init_wc_data(struct connectdata *conn); static CURLcode wc_statemach(struct connectdata *conn); diff --git a/lib/mime.c b/lib/mime.c index e13d92e94..1d6d70f02 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -685,7 +685,7 @@ static void mime_mem_free(void *ptr) /* Named file callbacks. */ /* Argument is a pointer to the mime part. */ -static int mime_open_file(curl_mimepart * part) +static int mime_open_file(curl_mimepart *part) { /* Open a MIMEKIND_FILE part. */ diff --git a/lib/select.h b/lib/select.h index 0fd8ed515..9b3e0783f 100644 --- a/lib/select.h +++ b/lib/select.h @@ -91,7 +91,7 @@ int Curl_wait_ms(int timeout_ms); #ifdef TPF int tpf_select_libcurl(int maxfds, fd_set* reads, fd_set* writes, - fd_set* excepts, struct timeval* tv); + fd_set* excepts, struct timeval *tv); #endif /* Winsock and TPF sockets are not in range [0..FD_SETSIZE-1], which diff --git a/lib/setup-os400.h b/lib/setup-os400.h index 629fd94c4..b693cb3b3 100644 --- a/lib/setup-os400.h +++ b/lib/setup-os400.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -200,10 +200,10 @@ extern OM_uint32 Curl_gss_delete_sec_context_a(OM_uint32 * minor_status, /* Some socket functions must be wrapped to process textual addresses like AF_UNIX. */ -extern int Curl_os400_connect(int sd, struct sockaddr * destaddr, int addrlen); -extern int Curl_os400_bind(int sd, struct sockaddr * localaddr, int addrlen); +extern int Curl_os400_connect(int sd, struct sockaddr *destaddr, int addrlen); +extern int Curl_os400_bind(int sd, struct sockaddr *localaddr, int addrlen); extern int Curl_os400_sendto(int sd, char *buffer, int buflen, int flags, - struct sockaddr * dstaddr, int addrlen); + struct sockaddr *dstaddr, int addrlen); extern int Curl_os400_recvfrom(int sd, char *buffer, int buflen, int flags, struct sockaddr *fromaddr, int *addrlen); extern int Curl_os400_getpeername(int sd, struct sockaddr *addr, int *addrlen); diff --git a/lib/setup-vms.h b/lib/setup-vms.h index 6c454aee6..482e69e46 100644 --- a/lib/setup-vms.h +++ b/lib/setup-vms.h @@ -73,7 +73,7 @@ char *decc$getenv(const char *__name); # endif #endif - struct passwd * decc_getpwuid(uid_t uid); + struct passwd *decc_getpwuid(uid_t uid); #ifdef __DECC # if __INITIAL_POINTER_SIZE == 32 @@ -138,9 +138,9 @@ static char *vms_getenv(const char *envvar) static struct passwd vms_passwd_cache; -static struct passwd * vms_getpwuid(uid_t uid) +static struct passwd *vms_getpwuid(uid_t uid) { - struct passwd * my_passwd; + struct passwd *my_passwd; /* Hack needed to support 64 bit builds, decc_getpwnam is 32 bit only */ #ifdef __DECC diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c index 7f66675fc..38a3056a4 100644 --- a/lib/socks_gssapi.c +++ b/lib/socks_gssapi.c @@ -115,7 +115,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex, gss_buffer_desc gss_send_token = GSS_C_EMPTY_BUFFER; gss_buffer_desc gss_recv_token = GSS_C_EMPTY_BUFFER; gss_buffer_desc gss_w_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc* gss_token = GSS_C_NO_BUFFER; + gss_buffer_desc *gss_token = GSS_C_NO_BUFFER; gss_name_t server = GSS_C_NO_NAME; gss_name_t gss_client_name = GSS_C_NO_NAME; unsigned short us_length; diff --git a/lib/tftp.c b/lib/tftp.c index 346f293dc..368b82abe 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -154,7 +154,7 @@ static CURLcode tftp_disconnect(struct connectdata *conn, static CURLcode tftp_do(struct connectdata *conn, bool *done); static CURLcode tftp_done(struct connectdata *conn, CURLcode, bool premature); -static CURLcode tftp_setup_connection(struct connectdata * conn); +static CURLcode tftp_setup_connection(struct connectdata *conn); static CURLcode tftp_multi_statemach(struct connectdata *conn, bool *done); static CURLcode tftp_doing(struct connectdata *conn, bool *dophase_done); static int tftp_getsock(struct connectdata *conn, curl_socket_t *socks); @@ -1384,7 +1384,7 @@ static CURLcode tftp_do(struct connectdata *conn, bool *done) return result; } -static CURLcode tftp_setup_connection(struct connectdata * conn) +static CURLcode tftp_setup_connection(struct connectdata *conn) { struct Curl_easy *data = conn->data; char *type; diff --git a/lib/url.c b/lib/url.c index ce94bac05..f250f2ff2 100644 --- a/lib/url.c +++ b/lib/url.c @@ -865,8 +865,8 @@ static int IsMultiplexingPossible(const struct Curl_easy *handle, #ifndef CURL_DISABLE_PROXY static bool -proxy_info_matches(const struct proxy_info* data, - const struct proxy_info* needle) +proxy_info_matches(const struct proxy_info *data, + const struct proxy_info *needle) { if((data->proxytype == needle->proxytype) && (data->port == needle->port) && @@ -877,8 +877,8 @@ proxy_info_matches(const struct proxy_info* data, } static bool -socks_proxy_info_matches(const struct proxy_info* data, - const struct proxy_info* needle) +socks_proxy_info_matches(const struct proxy_info *data, + const struct proxy_info *needle) { if(!proxy_info_matches(data, needle)) return FALSE; @@ -2002,7 +2002,7 @@ static CURLcode setup_range(struct Curl_easy *data) */ static CURLcode setup_connection_internals(struct connectdata *conn) { - const struct Curl_handler * p; + const struct Curl_handler *p; CURLcode result; /* Perform setup complement if some. */ diff --git a/lib/url.h b/lib/url.h index 5000c512a..a22569393 100644 --- a/lib/url.h +++ b/lib/url.h @@ -47,7 +47,7 @@ CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn); CURLcode Curl_open(struct Curl_easy **curl); CURLcode Curl_init_userdefined(struct Curl_easy *data); -void Curl_freeset(struct Curl_easy * data); +void Curl_freeset(struct Curl_easy *data); CURLcode Curl_uc_to_curlcode(CURLUcode uc); CURLcode Curl_close(struct Curl_easy **datap); /* opposite of curl_open() */ CURLcode Curl_connect(struct Curl_easy *, bool *async, bool *protocol_connect); diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index cbf3d3dec..0df6bb4ae 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -239,7 +239,7 @@ mbed_connect_step1(struct connectdata *conn, int sockindex) { struct Curl_easy *data = conn->data; - struct ssl_connect_data* connssl = &conn->ssl[sockindex]; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct ssl_backend_data *backend = connssl->backend; const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile); const bool verifypeer = SSL_CONN_CONFIG(verifypeer); @@ -535,7 +535,7 @@ mbed_connect_step2(struct connectdata *conn, { int ret; struct Curl_easy *data = conn->data; - struct ssl_connect_data* connssl = &conn->ssl[sockindex]; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct ssl_backend_data *backend = connssl->backend; const mbedtls_x509_crt *peercert; const char * const pinnedpubkey = SSL_IS_PROXY() ? diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index f1b525227..9dc7eaee2 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -83,8 +83,8 @@ dest->var = NULL; bool -Curl_ssl_config_matches(struct ssl_primary_config* data, - struct ssl_primary_config* needle) +Curl_ssl_config_matches(struct ssl_primary_config *data, + struct ssl_primary_config *needle) { if((data->version == needle->version) && (data->version_max == needle->version_max) && @@ -127,7 +127,7 @@ Curl_clone_primary_ssl_config(struct ssl_primary_config *source, return TRUE; } -void Curl_free_primary_ssl_config(struct ssl_primary_config* sslc) +void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc) { Curl_safefree(sslc->CApath); Curl_safefree(sslc->CAfile); diff --git a/lib/vtls/vtls.h b/lib/vtls/vtls.h index a81b2f22d..d34f42ade 100644 --- a/lib/vtls/vtls.h +++ b/lib/vtls/vtls.h @@ -138,11 +138,11 @@ CURLcode Curl_none_md5sum(unsigned char *input, size_t inputlen, #define SSL_CONN_CONFIG(var) (SSL_IS_PROXY() ? \ conn->proxy_ssl_config.var : conn->ssl_config.var) -bool Curl_ssl_config_matches(struct ssl_primary_config* data, - struct ssl_primary_config* needle); +bool Curl_ssl_config_matches(struct ssl_primary_config *data, + struct ssl_primary_config *needle); bool Curl_clone_primary_ssl_config(struct ssl_primary_config *source, struct ssl_primary_config *dest); -void Curl_free_primary_ssl_config(struct ssl_primary_config* sslc); +void Curl_free_primary_ssl_config(struct ssl_primary_config *sslc); int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks); int Curl_ssl_backend(void); diff --git a/lib/vtls/wolfssl.c b/lib/vtls/wolfssl.c index 5040b0592..4844c9e39 100644 --- a/lib/vtls/wolfssl.c +++ b/lib/vtls/wolfssl.c @@ -120,7 +120,7 @@ wolfssl_connect_step1(struct connectdata *conn, { char *ciphers; struct Curl_easy *data = conn->data; - struct ssl_connect_data* connssl = &conn->ssl[sockindex]; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct ssl_backend_data *backend = connssl->backend; SSL_METHOD* req_method = NULL; curl_socket_t sockfd = conn->sock[sockindex]; @@ -423,7 +423,7 @@ wolfssl_connect_step2(struct connectdata *conn, { int ret = -1; struct Curl_easy *data = conn->data; - struct ssl_connect_data* connssl = &conn->ssl[sockindex]; + struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct ssl_backend_data *backend = connssl->backend; const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name; @@ -760,7 +760,7 @@ static void Curl_wolfssl_cleanup(void) } -static bool Curl_wolfssl_data_pending(const struct connectdata* conn, +static bool Curl_wolfssl_data_pending(const struct connectdata *conn, int connindex) { const struct ssl_connect_data *connssl = &conn->ssl[connindex]; diff --git a/lib/x509asn1.c b/lib/x509asn1.c index ece5364d8..8fd6b5087 100644 --- a/lib/x509asn1.c +++ b/lib/x509asn1.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -176,7 +176,7 @@ static const char *getASN1Element(curl_asn1Element *elem, * Search the null terminated OID or OID identifier in local table. * Return the table entry pointer or NULL if not found. */ -static const curl_OID * searchOID(const char *oid) +static const curl_OID *searchOID(const char *oid) { const curl_OID *op; for(op = OIDtable; op->numoid; op++) diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index f802a5a31..64cdd86d2 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -26,7 +26,7 @@ #include "memdebug.h" /* keep this as LAST include */ -void config_init(struct OperationConfig* config) +void config_init(struct OperationConfig *config) { memset(config, 0, sizeof(struct OperationConfig)); diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c index c0678b0e5..96841052b 100644 --- a/tests/libtest/lib582.c +++ b/tests/libtest/lib582.c @@ -44,7 +44,7 @@ struct ReadWriteSockets /** * Remove a file descriptor from a sockets array. */ -static void removeFd(struct Sockets* sockets, curl_socket_t fd, int mention) +static void removeFd(struct Sockets *sockets, curl_socket_t fd, int mention) { int i; @@ -64,7 +64,7 @@ static void removeFd(struct Sockets* sockets, curl_socket_t fd, int mention) /** * Add a file descriptor to a sockets array. */ -static void addFd(struct Sockets* sockets, curl_socket_t fd, const char *what) +static void addFd(struct Sockets *sockets, curl_socket_t fd, const char *what) { /** * To ensure we only have each file descriptor once, we remove it then add @@ -105,7 +105,7 @@ static void addFd(struct Sockets* sockets, curl_socket_t fd, const char *what) static int curlSocketCallback(CURL *easy, curl_socket_t s, int action, void *userp, void *socketp) { - struct ReadWriteSockets* sockets = userp; + struct ReadWriteSockets *sockets = userp; (void)easy; /* unused */ (void)socketp; /* unused */ @@ -129,7 +129,7 @@ static int curlSocketCallback(CURL *easy, curl_socket_t s, int action, */ static int curlTimerCallback(CURLM *multi, long timeout_ms, void *userp) { - struct timeval* timeout = userp; + struct timeval *timeout = userp; (void)multi; /* unused */ if(timeout_ms != -1) { @@ -169,7 +169,7 @@ static int checkForCompletion(CURLM *curl, int *success) return result; } -static int getMicroSecondTimeout(struct timeval* timeout) +static int getMicroSecondTimeout(struct timeval *timeout) { struct timeval now; ssize_t result; @@ -185,7 +185,7 @@ static int getMicroSecondTimeout(struct timeval* timeout) /** * Update a fd_set with all of the sockets in use. */ -static void updateFdSet(struct Sockets* sockets, fd_set* fdset, +static void updateFdSet(struct Sockets *sockets, fd_set* fdset, curl_socket_t *maxFd) { int i; diff --git a/tests/unit/unit1309.c b/tests/unit/unit1309.c index 9d885389d..880530313 100644 --- a/tests/unit/unit1309.c +++ b/tests/unit/unit1309.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2018, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -35,7 +35,7 @@ static void unit_stop(void) } -static void splayprint(struct Curl_tree * t, int d, char output) +static void splayprint(struct Curl_tree *t, int d, char output) { struct Curl_tree *node; int i; diff --git a/tests/unit/unit1608.c b/tests/unit/unit1608.c index 38d5cb278..9105e2847 100644 --- a/tests/unit/unit1608.c +++ b/tests/unit/unit1608.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2019, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -48,7 +48,7 @@ UNITTEST_START { int i; CURLcode code; - struct Curl_addrinfo* addrhead = addrs; + struct Curl_addrinfo *addrhead = addrs; struct Curl_easy *easy = curl_easy_init(); abort_unless(easy, "out of memory"); -- cgit v1.2.3