gnunet-svn
[Top][All Lists]
Advanced

[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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]