diff options
author | christos <christos@pkgsrc.org> | 2021-11-07 12:38:12 +0000 |
---|---|---|
committer | christos <christos@pkgsrc.org> | 2021-11-07 12:38:12 +0000 |
commit | 8c372a971347bd0d032a7869ffeae2108c7d4259 (patch) | |
tree | b1cd70ab4960e6014bdd09d919972085d33925e0 /pkgtools/cwrappers | |
parent | 2d14e6493ad139b33badccc93e76ed87d0ff2ffd (diff) | |
download | pkgsrc-8c372a971347bd0d032a7869ffeae2108c7d4259.tar.gz |
abstract check for "*path == '/'" to isabs(*path)
Diffstat (limited to 'pkgtools/cwrappers')
-rw-r--r-- | pkgtools/cwrappers/files/bin/cleanup-cc.c | 4 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/common.h | 4 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/fixup-libtool.c | 18 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/generic-transform-cc.c | 16 | ||||
-rw-r--r-- | pkgtools/cwrappers/files/bin/normalise-cc.c | 8 |
5 files changed, 26 insertions, 24 deletions
diff --git a/pkgtools/cwrappers/files/bin/cleanup-cc.c b/pkgtools/cwrappers/files/bin/cleanup-cc.c index 282ad8e831c..8bc85697685 100644 --- a/pkgtools/cwrappers/files/bin/cleanup-cc.c +++ b/pkgtools/cwrappers/files/bin/cleanup-cc.c @@ -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>. @@ -52,7 +52,7 @@ cleanup_cc(struct arglist *args) 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 --git a/pkgtools/cwrappers/files/bin/common.h b/pkgtools/cwrappers/files/bin/common.h index a5126752640..5348f023480 100644 --- a/pkgtools/cwrappers/files/bin/common.h +++ b/pkgtools/cwrappers/files/bin/common.h @@ -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>. @@ -121,4 +121,6 @@ void fixup_libtool(struct arglist *); void mi_vector_hash(const void *, size_t, uint32_t, uint32_t[3]); #endif +#define isabs(a) ((a) == '/') + #endif diff --git a/pkgtools/cwrappers/files/bin/fixup-libtool.c b/pkgtools/cwrappers/files/bin/fixup-libtool.c index 13869d71789..a5721355276 100644 --- a/pkgtools/cwrappers/files/bin/fixup-libtool.c +++ b/pkgtools/cwrappers/files/bin/fixup-libtool.c @@ -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>. @@ -127,7 +127,7 @@ process_option(struct processing_option *opt, const char *line, size_t len, 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 @@ process_option(struct processing_option *opt, const char *line, size_t len, 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 @@ process_option(struct processing_option *opt, const char *line, size_t len, 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 @@ process_option(struct processing_option *opt, const char *line, size_t len, 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 @@ process_option(struct processing_option *opt, const char *line, size_t len, wlen = strlen(wrksrc); if (wlen > len || - (wlen != len && line[wlen] != '/') || + (wlen != len && !isabs(line[wlen])) || strncmp(wrksrc, line, wlen)) goto print_option; diff --git a/pkgtools/cwrappers/files/bin/generic-transform-cc.c b/pkgtools/cwrappers/files/bin/generic-transform-cc.c index abb208b5b34..f61e9acd36e 100644 --- a/pkgtools/cwrappers/files/bin/generic-transform-cc.c +++ b/pkgtools/cwrappers/files/bin/generic-transform-cc.c @@ -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>. @@ -264,7 +264,7 @@ generic_transform_cc_absolute(struct arglist *args, struct argument *arg) 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 @@ generic_transform_libtool_lib(struct arglist *args, struct argument *arg) 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 @@ generic_transform_cc(struct arglist *args) 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 @@ generic_transform_cc(struct arglist *args) } 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 @@ generic_transform_cc(struct arglist *args) 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 --git a/pkgtools/cwrappers/files/bin/normalise-cc.c b/pkgtools/cwrappers/files/bin/normalise-cc.c index 51a28de8412..7c884cbba99 100644 --- a/pkgtools/cwrappers/files/bin/normalise-cc.c +++ b/pkgtools/cwrappers/files/bin/normalise-cc.c @@ -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>. @@ -44,7 +44,7 @@ normalise_path_list(struct arglist *args, struct argument *arg, 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 @@ normalise_path_list(struct arglist *args, struct argument *arg, 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 @@ normalise_cc(struct arglist *args) 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)) |