pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/check-portability/files pkgtools/check-portab...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d3da8d4467e0
branches:  trunk
changeset: 424539:d3da8d4467e0
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Mar 12 08:55:07 2020 +0000

description:
pkgtools/check-portability: minor stylistic corrections

diffstat:

 pkgtools/check-portability/files/check-portability.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r f1eeb7c7a87b -r d3da8d4467e0 pkgtools/check-portability/files/check-portability.c
--- a/pkgtools/check-portability/files/check-portability.c      Thu Mar 12 08:44:15 2020 +0000
+++ b/pkgtools/check-portability/files/check-portability.c      Thu Mar 12 08:55:07 2020 +0000
@@ -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_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 @@
        // 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 @@
        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