Skip to content

Commit

Permalink
checksrc: enhance the ASTERISKSPACE and update code accordingly
Browse files Browse the repository at this point in the history
Fine: "struct hello *world"

Not fine: "struct hello* world" (and variations)

Closes curl#5386
  • Loading branch information
bagder committed May 13, 2020
1 parent f3f5d82 commit 66b0775
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 56 deletions.
4 changes: 2 additions & 2 deletions docs/examples/multi-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, 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 @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions docs/examples/multi-uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, 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 @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions lib/asyn-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions lib/checksrc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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)\*)/)) {
Expand Down
4 changes: 2 additions & 2 deletions lib/curl_threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, 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 @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion lib/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/mime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */

Expand Down
2 changes: 1 addition & 1 deletion lib/select.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/setup-os400.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, 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 @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions lib/setup-vms.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/socks_gssapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/tftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions lib/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand All @@ -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;
Expand Down Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion lib/url.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/vtls/mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() ?
Expand Down
6 changes: 3 additions & 3 deletions lib/vtls/vtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions lib/vtls/vtls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions lib/vtls/wolfssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions lib/x509asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, 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 @@ -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++)
Expand Down
4 changes: 2 additions & 2 deletions src/tool_cfgable.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2020, 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 @@ -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));

Expand Down
Loading

0 comments on commit 66b0775

Please sign in to comment.