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/8e1a88049f6c
branches:  trunk
changeset: 412795:8e1a88049f6c
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 9c73ca3ab5a1 -r 8e1a88049f6c 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