mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 15:48:49 -05:00
checksrc: stricter no-space-before-paren enforcement
In order to make the code style more uniform everywhere
This commit is contained in:
parent
5fad800efd
commit
b228d2952b
@ -1910,7 +1910,10 @@ typedef enum {
|
|||||||
|
|
||||||
|
|
||||||
/* curl_strequal() and curl_strnequal() are subject for removal in a future
|
/* 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_strequal)(const char *s1, const char *s2);
|
||||||
CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
|
CURL_EXTERN int (curl_strnequal)(const char *s1, const char *s2, size_t n);
|
||||||
|
|
||||||
|
@ -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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
|
@ -243,6 +243,12 @@ sub checksrc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub nostrings {
|
||||||
|
my ($str) = @_;
|
||||||
|
$str =~ s/\".*\"//g;
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
|
|
||||||
sub scanfile {
|
sub scanfile {
|
||||||
my ($file) = @_;
|
my ($file) = @_;
|
||||||
|
|
||||||
@ -329,11 +335,21 @@ sub scanfile {
|
|||||||
$line, length($1), $file, $l, "\/\/ comment");
|
$line, length($1), $file, $l, "\/\/ comment");
|
||||||
}
|
}
|
||||||
|
|
||||||
# check spaces after for/if/while
|
my $nostr = nostrings($l);
|
||||||
if($l =~ /^(.*)(for|if|while) \(/) {
|
# check spaces after for/if/while/function call
|
||||||
|
if($nostr =~ /^(.*)(for|if|while| ([a-zA-Z0-9_]+)) \((.)/) {
|
||||||
if($1 =~ / *\#/) {
|
if($1 =~ / *\#/) {
|
||||||
# this is a #if, treat it differently
|
# this is a #if, treat it differently
|
||||||
}
|
}
|
||||||
|
elsif($3 eq "return") {
|
||||||
|
# return must have a space
|
||||||
|
}
|
||||||
|
elsif($4 eq "*") {
|
||||||
|
# (* beginning makes the space OK!
|
||||||
|
}
|
||||||
|
elsif($1 =~ / *typedef/) {
|
||||||
|
# typedefs can use space-paren
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
checkwarn("SPACEBEFOREPAREN", $line, length($1)+length($2), $file, $l,
|
checkwarn("SPACEBEFOREPAREN", $line, length($1)+length($2), $file, $l,
|
||||||
"$2 with space");
|
"$2 with space");
|
||||||
|
@ -100,6 +100,7 @@ int Curl_thread_join(curl_thread_t *hnd)
|
|||||||
|
|
||||||
#elif defined(USE_THREADS_WIN32)
|
#elif defined(USE_THREADS_WIN32)
|
||||||
|
|
||||||
|
/* !checksrc! disable SPACEBEFOREPAREN 1 */
|
||||||
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
|
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
|
#if defined(USE_THREADS_POSIX) || defined(USE_THREADS_WIN32)
|
||||||
|
|
||||||
|
/* !checksrc! disable SPACEBEFOREPAREN 1 */
|
||||||
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
|
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void *),
|
||||||
void *arg);
|
void *arg);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2015, 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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2015, 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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2015, 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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2012, 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
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
|
Loading…
Reference in New Issue
Block a user