pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/check-portability/files



Module Name:    pkgsrc
Committed By:   rillig
Date:           Thu Mar 12 08:55:07 UTC 2020

Modified Files:
        pkgsrc/pkgtools/check-portability/files: check-portability.c

Log Message:
pkgtools/check-portability: minor stylistic corrections


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
    pkgsrc/pkgtools/check-portability/files/check-portability.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/check-portability/files/check-portability.c
diff -u pkgsrc/pkgtools/check-portability/files/check-portability.c:1.4 pkgsrc/pkgtools/check-portability/files/check-portability.c:1.5
--- pkgsrc/pkgtools/check-portability/files/check-portability.c:1.4     Thu Mar 12 08:42:34 2020
+++ pkgsrc/pkgtools/check-portability/files/check-portability.c Thu Mar 12 08:55:07 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: check-portability.c,v 1.4 2020/03/12 08:42:34 rillig Exp $ */
+/* $NetBSD: check-portability.c,v 1.5 2020/03/12 08:55:07 rillig Exp $ */
 
 /*
  Copyright (c) 2020 Roland Illig
@@ -35,7 +35,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define nullptr ((void *)0)
+#define nullptr ((void *) 0)
 static const size_t npos = -1;
 
 static bool
@@ -208,7 +208,7 @@ str_charptr(str *s)
 {
        str_reserve(s, 1);
        s->data[s->len] = '\0';
-       assert(memchr(s->data, 0, s->len) == nullptr);
+       assert(memchr(s->data, '\0', s->len) == nullptr);
        return s->data;
 }
 
@@ -339,6 +339,8 @@ checkline_sh_dollar_random(cstr filename
        // a safe usage of $RANDOM, it will pass the test.
        if (is_shell_comment(line))
                return;
+       if (!cstr_contains(line, CSTR("$RANDOM")))
+               return;
 
        // $RANDOM together with the PID is often found in GNU-style
        // configure scripts and is considered acceptable.
@@ -352,9 +354,6 @@ checkline_sh_dollar_random(cstr filename
        if (idx != npos && idx + 7 < line.len && is_alnum(line.data[idx + 7]))
                return;
 
-       if (!cstr_contains(line, CSTR("$RANDOM")))
-               return;
-
        printf("%s:%zu:%zu: $RANDOM: %s\n",
            cstr_charptr(filename), lineno, idx + 1,
            cstr_charptr(line));



Home | Main Index | Thread Index | Old Index