Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8922b8ec0bcc
branches:  trunk
changeset: 429385:8922b8ec0bcc
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun Apr 19 12:05:14 2020 +0000

description:
pkgtools/check-portability: update to 20.1.0

Changes since 19.4.3:

The variable name RANDOM_FILE is ok since it doesn't have a special
meaning to some shell implementations. Seen in www/curl.

diffstat:

 pkgtools/check-portability/Makefile                  |   4 ++--
 pkgtools/check-portability/files/check-portability.c |  12 ++++++------
 pkgtools/check-portability/files/testdata/random     |   3 +++
 3 files changed, 11 insertions(+), 8 deletions(-)

diffs (67 lines):

diff -r 7cdb50cd61cb -r 8922b8ec0bcc pkgtools/check-portability/Makefile
--- a/pkgtools/check-portability/Makefile       Sun Apr 19 11:59:24 2020 +0000
+++ b/pkgtools/check-portability/Makefile       Sun Apr 19 12:05:14 2020 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.8 2020/03/21 15:02:20 rillig Exp $
+# $NetBSD: Makefile,v 1.9 2020/04/19 12:05:14 rillig Exp $
 
-PKGNAME=       check-portability-19.4.3
+PKGNAME=       check-portability-20.1.0
 CATEGORIES=    pkgtools
 DISTFILES=     # none
 
diff -r 7cdb50cd61cb -r 8922b8ec0bcc pkgtools/check-portability/files/check-portability.c
--- a/pkgtools/check-portability/files/check-portability.c      Sun Apr 19 11:59:24 2020 +0000
+++ b/pkgtools/check-portability/files/check-portability.c      Sun Apr 19 12:05:14 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: check-portability.c,v 1.12 2020/03/21 15:02:20 rillig Exp $ */
+/* $NetBSD: check-portability.c,v 1.13 2020/04/19 12:05:14 rillig Exp $ */
 
 /*
  Copyright (c) 2020 Roland Illig
@@ -39,9 +39,9 @@
 static const size_t npos = -1;
 
 static bool
-is_alnum(char c)
+is_alnumu(char c)
 {
-       return isalnum((unsigned char) c) != 0;
+       return isalnum((unsigned char) c) != 0 || c == '_';
 }
 
 static bool
@@ -160,12 +160,12 @@
 }
 
 static bool
-cstr_has_word_boundary(cstr s, size_t idx)
+cstr_has_varname_boundary(cstr s, size_t idx)
 {
        assert(idx <= s.len);
        if (idx == 0 || idx == s.len)
                return true;
-       return is_alnum(s.data[idx - 1]) != is_alnum(s.data[idx]);
+       return is_alnumu(s.data[idx - 1]) != is_alnumu(s.data[idx]);
 }
 
 // str is a modifiable string buffer.
@@ -376,7 +376,7 @@
        size_t idx = cstr_index(line, CSTR("$RANDOM"));
 
        // Variable names that only start with RANDOM are not special.
-       if (idx == npos || !cstr_has_word_boundary(line, idx + 7))
+       if (idx == npos || !cstr_has_varname_boundary(line, idx + 7))
                return;
 
        // $RANDOM together with the PID is often found in GNU-style
diff -r 7cdb50cd61cb -r 8922b8ec0bcc pkgtools/check-portability/files/testdata/random
--- a/pkgtools/check-portability/files/testdata/random  Sun Apr 19 11:59:24 2020 +0000
+++ b/pkgtools/check-portability/files/testdata/random  Sun Apr 19 12:05:14 2020 +0000
@@ -16,3 +16,6 @@
 
 # This is not a special variable.
 $RANDOMNESS
+
+# This is not a special variable as well.
+$RANDOM_FILE



Home | Main Index | Thread Index | Old Index