diff options
author | rillig <rillig@pkgsrc.org> | 2020-03-12 08:55:07 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2020-03-12 08:55:07 +0000 |
commit | 5e4925ecfdd373ec1c79b3d837dbcacc8231fde3 (patch) | |
tree | 4d995225722c0f87467b49eef7a0e76bab0c2bea /pkgtools | |
parent | 0ad39added933a32b48c95677cfbbe37c61de80e (diff) | |
download | pkgsrc-5e4925ecfdd373ec1c79b3d837dbcacc8231fde3.tar.gz |
pkgtools/check-portability: minor stylistic corrections
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/check-portability/files/check-portability.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/pkgtools/check-portability/files/check-portability.c b/pkgtools/check-portability/files/check-portability.c index 1cedc83ca15..5f39211c099 100644 --- a/pkgtools/check-portability/files/check-portability.c +++ b/pkgtools/check-portability/files/check-portability.c @@ -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, size_t lineno, cstr line) // 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, size_t lineno, cstr line) 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)); |