[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 15/411: checksrc: verify do-while and spaces between the braces
From: |
gnunet |
Subject: |
[gnurl] 15/411: checksrc: verify do-while and spaces between the braces |
Date: |
Wed, 13 Jan 2021 01:17:10 +0100 |
This is an automated email from the git hooks/post-receive script.
nikita pushed a commit to branch master
in repository gnurl.
commit 4ebac06106825a5d28be4c38e62732c911168605
Author: Daniel Stenberg <daniel@haxx.se>
AuthorDate: Mon Aug 24 09:31:39 2020 +0200
checksrc: verify do-while and spaces between the braces
Updated mprintf.c to comply
Closes #5845
---
lib/checksrc.pl | 10 ++++++++++
lib/mprintf.c | 10 +++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index 498da94bb..e7eb454f1 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -82,6 +82,8 @@ my %warnings = (
'SNPRINTF' => 'use of snprintf',
'ONELINECONDITION' => 'conditional block on the same line as the if()',
'TYPEDEFSTRUCT' => 'typedefed struct',
+ 'DOBRACE' => 'A single space between do and open brace',
+ 'BRACEWHILE' => 'A single space between open brace and while',
);
sub readskiplist {
@@ -468,6 +470,14 @@ sub scanfile {
}
}
+ # check spaces in 'do {'
+ if($nostr =~ /^( *)do( *)\{/ && length($2) != 1) {
+ checkwarn("DOBRACE", $line, length($1) + 2, $file, $l, "one space
after do before brace");
+ }
+ # check spaces in 'do {'
+ elsif($nostr =~ /^( *)\}( *)while/ && length($2) != 1) {
+ checkwarn("BRACEWHILE", $line, length($1) + 2, $file, $l, "one
space between brace and while");
+ }
if($nostr =~ /^((.*\s)(if) *\()(.*)\)(.*)/) {
my $pos = length($1);
my $postparen = $5;
diff --git a/lib/mprintf.c b/lib/mprintf.c
index 80735be51..6b62fdfbc 100644
--- a/lib/mprintf.c
+++ b/lib/mprintf.c
@@ -99,12 +99,12 @@ static const char lower_digits[] =
"0123456789abcdefghijklmnopqrstuvwxyz";
/* Upper-case digits. */
static const char upper_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-#define OUTCHAR(x) \
- do{ \
+#define OUTCHAR(x) \
+ do { \
if(stream((unsigned char)(x), (FILE *)data) != -1) \
- done++; \
- else \
- return done; /* return immediately on failure */ \
+ done++; \
+ else \
+ return done; /* return immediately on failure */ \
} while(0)
/* Data type to read from the arglist */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnurl] 26/411: lib1560: verify "redirect" to double-slash leading URL, (continued)
- [gnurl] 26/411: lib1560: verify "redirect" to double-slash leading URL, gnunet, 2021/01/12
- [gnurl] 17/411: sftp: add the option CURLKHSTAT_FINE_REPLACE, gnunet, 2021/01/12
- [gnurl] 19/411: curl: add --output-dir, gnunet, 2021/01/12
- [gnurl] 30/411: doh: add error message for DOH_DNS_NAME_TOO_LONG, gnunet, 2021/01/12
- [gnurl] 29/411: ngtcp2: adapt to the new pkt_info arguments, gnunet, 2021/01/12
- [gnurl] 16/411: RELEASE-NOTES: synced, gnunet, 2021/01/12
- [gnurl] 24/411: multi: implement wait using winsock events, gnunet, 2021/01/12
- [gnurl] 12/411: setopt: if the buffer exists, refuse the new BUFFERSIZE, gnunet, 2021/01/12
- [gnurl] 13/411: etag: save and use the full received contents, gnunet, 2021/01/12
- [gnurl] 27/411: winbuild: convert the instruction text to README.md, gnunet, 2021/01/12
- [gnurl] 15/411: checksrc: verify do-while and spaces between the braces,
gnunet <=
- [gnurl] 59/411: docs: add description about CI platforms to CONTRIBUTE.md, gnunet, 2021/01/12
- [gnurl] 67/411: curl.1: add see also no-progress-meter on two spots, gnunet, 2021/01/12
- [gnurl] 41/411: docs/libcurl: update "Added in" version for curl_easy_option*, gnunet, 2021/01/12
- [gnurl] 35/411: openssl: Fix wincrypt symbols conflict with BoringSSL, gnunet, 2021/01/12
- [gnurl] 18/411: configure: fix pkg-config detecting wolfssl, gnunet, 2021/01/12
- [gnurl] 32/411: schannel: fix memory leak when using get_cert_location, gnunet, 2021/01/12
- [gnurl] 10/411: CURLE_PROXY: new error code, gnunet, 2021/01/12
- [gnurl] 43/411: buildconf: invoke 'autoreconf -fi' instead, gnunet, 2021/01/12
- [gnurl] 49/411: multi: handle connection state winsock events, gnunet, 2021/01/12
- [gnurl] 57/411: ntlm: fix condition for curl_ntlm_core usage, gnunet, 2021/01/12