pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/cwrappers/files/bin abstract check for "*path...
details: https://anonhg.NetBSD.org/pkgsrc/rev/c7d13edf6bfe
branches: trunk
changeset: 769069:c7d13edf6bfe
user: christos <christos%pkgsrc.org@localhost>
date: Sun Nov 07 12:38:12 2021 +0000
description:
abstract check for "*path == '/'" to isabs(*path)
diffstat:
pkgtools/cwrappers/files/bin/cleanup-cc.c | 4 ++--
pkgtools/cwrappers/files/bin/common.h | 4 +++-
pkgtools/cwrappers/files/bin/fixup-libtool.c | 18 +++++++++---------
pkgtools/cwrappers/files/bin/generic-transform-cc.c | 16 ++++++++--------
pkgtools/cwrappers/files/bin/normalise-cc.c | 8 ++++----
5 files changed, 26 insertions(+), 24 deletions(-)
diffs (205 lines):
diff -r b48108322342 -r c7d13edf6bfe pkgtools/cwrappers/files/bin/cleanup-cc.c
--- a/pkgtools/cwrappers/files/bin/cleanup-cc.c Sun Nov 07 12:18:58 2021 +0000
+++ b/pkgtools/cwrappers/files/bin/cleanup-cc.c Sun Nov 07 12:38:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cleanup-cc.c,v 1.3 2016/01/10 19:13:05 bsiegert Exp $ */
+/* $NetBSD: cleanup-cc.c,v 1.4 2021/11/07 12:38:12 christos Exp $ */
/*-
* Copyright (c) 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -52,7 +52,7 @@
if (arg->val[0] != '-')
continue;
if (strncmp(arg->val, "-Wl,-rpath,", 11) == 0) {
- if (arg->val[11] == '/')
+ if (isabs(arg->val[11]))
continue;
argument_unlink(args, &arg);
continue;
diff -r b48108322342 -r c7d13edf6bfe pkgtools/cwrappers/files/bin/common.h
--- a/pkgtools/cwrappers/files/bin/common.h Sun Nov 07 12:18:58 2021 +0000
+++ b/pkgtools/cwrappers/files/bin/common.h Sun Nov 07 12:38:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: common.h,v 1.8 2017/11/07 16:49:22 khorben Exp $ */
+/* $NetBSD: common.h,v 1.9 2021/11/07 12:38:12 christos Exp $ */
/*-
* Copyright (c) 2009, 2017 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -121,4 +121,6 @@
void mi_vector_hash(const void *, size_t, uint32_t, uint32_t[3]);
#endif
+#define isabs(a) ((a) == '/')
+
#endif
diff -r b48108322342 -r c7d13edf6bfe pkgtools/cwrappers/files/bin/fixup-libtool.c
--- a/pkgtools/cwrappers/files/bin/fixup-libtool.c Sun Nov 07 12:18:58 2021 +0000
+++ b/pkgtools/cwrappers/files/bin/fixup-libtool.c Sun Nov 07 12:38:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fixup-libtool.c,v 1.7 2015/04/19 14:30:07 jperkin Exp $ */
+/* $NetBSD: fixup-libtool.c,v 1.8 2021/11/07 12:38:12 christos Exp $ */
/*-
* Copyright (c) 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -127,7 +127,7 @@
continue;
if (strncmp(line + 2, r->src, r->src_len))
continue;
- if (line[r->src_len + 2] != '/' &&
+ if (!isabs(line[r->src_len + 2]) &&
len != r->src_len + 2)
continue;
line += r->src_len + 2;
@@ -144,7 +144,7 @@
if (wlen <= len - 2 &&
strncmp(line + 2, wrksrc, wlen) == 0 &&
- (line[wlen + 2] == '/' || wlen + 2 == len))
+ (isabs(line[wlen + 2]) || wlen + 2 == len))
return;
}
}
@@ -170,17 +170,17 @@
goto print_option;
for (eol = line + len - 3; eol > line; --eol) {
- if (*eol == '/')
+ if (isabs(*eol))
break;
}
- if (opt->in_lai && *eol == '/') {
+ if (opt->in_lai && isabs(*eol)) {
TAILQ_FOREACH(r, &unwrap_rules, link) {
if (eol < line + r->src_len)
continue;
if (strncmp(line, r->src, r->src_len))
continue;
- if (line[r->src_len] != '/')
+ if (!isabs(*eol))
continue;
line += r->src_len;
len -= r->src_len;
@@ -212,12 +212,12 @@
len == strlen(opt->lafile))
goto print_option;
- if (*line != '/' && line == eol) {
+ if (!isabs(*line) && line == eol) {
process_option(opt, "-L./.libs", 9, in_relink);
goto print_option;
}
- if (*line != '/') {
+ if (!isabs(*line)) {
tmp = xasprintf("-L%*.*s/.libs", (int)(eol - line),
(int)(eol - line), line);
process_option(opt, tmp, strlen(tmp), in_relink);
@@ -230,7 +230,7 @@
wlen = strlen(wrksrc);
if (wlen > len ||
- (wlen != len && line[wlen] != '/') ||
+ (wlen != len && !isabs(line[wlen])) ||
strncmp(wrksrc, line, wlen))
goto print_option;
diff -r b48108322342 -r c7d13edf6bfe pkgtools/cwrappers/files/bin/generic-transform-cc.c
--- a/pkgtools/cwrappers/files/bin/generic-transform-cc.c Sun Nov 07 12:18:58 2021 +0000
+++ b/pkgtools/cwrappers/files/bin/generic-transform-cc.c Sun Nov 07 12:38:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: generic-transform-cc.c,v 1.4 2016/03/14 20:16:08 markd Exp $ */
+/* $NetBSD: generic-transform-cc.c,v 1.5 2021/11/07 12:38:12 christos Exp $ */
/*-
* Copyright (c) 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -264,7 +264,7 @@
TAILQ_FOREACH(rule, &libpath_rules, link) {
if (rule->src_len > len)
continue;
- if (arg->val[rule->src_len] != '/')
+ if (!isabs(arg->val[rule->src_len]))
continue;
if (strncmp(arg->val, rule->src, rule->src_len))
continue;
@@ -297,7 +297,7 @@
free(fname);
continue;
}
- if (arg2->val[2] == '/') {
+ if (isabs(arg2->val[2])) {
if (wrksrc == NULL)
return 0;
if (strncmp(arg2->val + 2, wrksrc, len))
@@ -346,7 +346,7 @@
continue;
#endif
- if (arg->val[0] == '/') {
+ if (isabs(arg->val[0])) {
#if defined(WRAPPER_LIBTOOL)
generic_transform_cc_absolute(args, arg);
#endif
@@ -435,14 +435,14 @@
} else
continue;
- if (*path != '/')
+ if (!isabs(*path))
continue;
- while (len > 1 && path[len - 1] == '/')
+ while (len > 1 && isabs(path[len - 1]))
--len;
TAILQ_FOREACH(rule, ruleset, link) {
- if (rule->src[rule->src_len - 1] == '/') {
+ if (isabs(rule->src[rule->src_len - 1])) {
if (rule->src_len - 1 != len)
continue;
if (memcmp(path, rule->src, len) != 0)
@@ -452,7 +452,7 @@
if (rule->src_len > len)
continue;
if (path[rule->src_len] != '\0' &&
- path[rule->src_len] != '/')
+ !isabs(path[rule->src_len]))
continue;
if (strncmp(path, rule->src, rule->src_len) == 0)
break;
diff -r b48108322342 -r c7d13edf6bfe pkgtools/cwrappers/files/bin/normalise-cc.c
--- a/pkgtools/cwrappers/files/bin/normalise-cc.c Sun Nov 07 12:18:58 2021 +0000
+++ b/pkgtools/cwrappers/files/bin/normalise-cc.c Sun Nov 07 12:38:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: normalise-cc.c,v 1.5 2017/06/11 19:34:43 joerg Exp $ */
+/* $NetBSD: normalise-cc.c,v 1.6 2021/11/07 12:38:12 christos Exp $ */
/*-
* Copyright (c) 2009, 2017 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -44,7 +44,7 @@
struct argument *arg2;
while ((sep = strchr(val, ':')) != NULL) {
- if (sep == val || (strip_relative && val[0] != '/')) {
+ if (sep == val || (strip_relative && !isabs(val[0]))) {
val = sep + 1;
continue;
}
@@ -53,7 +53,7 @@
arg = arg2;
val = sep + 1;
}
- if (val[0] == '\0' || (strip_relative && val[0] != '/'))
+ if (val[0] == '\0' || (strip_relative && !isabs(val[0])))
return;
arg2 = argument_new(concat(prefix, val));
TAILQ_INSERT_AFTER(args, arg, arg2, link);
@@ -151,7 +151,7 @@
arg2 = TAILQ_NEXT(arg2, link);
continue;
}
- if (arg->val[0] == '/') {
+ if (isabs(arg->val[0])) {
next = strrchr(arg->val, '/');
++next;
if (strncmp(next, "lib", 3))
Home |
Main Index |
Thread Index |
Old Index