Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): clean up suffix handling code
details: https://anonhg.NetBSD.org/src/rev/b317ae9ed35e
branches: trunk
changeset: 1015359:b317ae9ed35e
user: rillig <rillig%NetBSD.org@localhost>
date: Wed Oct 21 07:11:50 2020 +0000
description:
make(1): clean up suffix handling code
Using (name, nameLen) is easier to understand than the unusual (nameLen,
nameEnd).
diffstat:
usr.bin/make/suff.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diffs (73 lines):
diff -r 683ea7448689 -r b317ae9ed35e usr.bin/make/suff.c
--- a/usr.bin/make/suff.c Wed Oct 21 07:05:52 2020 +0000
+++ b/usr.bin/make/suff.c Wed Oct 21 07:11:50 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: suff.c,v 1.207 2020/10/21 07:05:52 rillig Exp $ */
+/* $NetBSD: suff.c,v 1.208 2020/10/21 07:11:50 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -129,7 +129,7 @@
#include "dir.h"
/* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.207 2020/10/21 07:05:52 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.208 2020/10/21 07:11:50 rillig Exp $");
#define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
#define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -1585,15 +1585,15 @@
}
static void
-SuffFindNormalDepsKnown(size_t nameLen, char *nameEnd, GNode *gn,
- const char *sopref, SrcList *srcs, SrcList *targs)
+SuffFindNormalDepsKnown(char *name, size_t nameLen, GNode *gn,
+ SrcList *srcs, SrcList *targs)
{
SuffListNode *ln;
const char *eopref;
Src *targ;
for (ln = sufflist->first; ln != NULL; ln = ln->next) {
- if (!SuffSuffIsSuffix(ln->datum, nameLen, nameEnd))
+ if (!SuffSuffIsSuffix(ln->datum, nameLen, name + nameLen))
continue;
targ = bmake_malloc(sizeof(Src));
@@ -1607,8 +1607,8 @@
targ->cp = Lst_New();
#endif
- eopref = nameEnd - targ->suff->nameLen;
- targ->pref = bmake_strsedup(sopref, eopref);
+ eopref = name + nameLen - targ->suff->nameLen;
+ targ->pref = bmake_strsedup(name, eopref);
/*
* Add nodes from which the target can be made
@@ -1745,9 +1745,8 @@
char *pref; /* Prefix to use */
Src *targ; /* General Src target pointer */
- size_t nameLen = strlen(gn->name);
- char *eoname = gn->name + nameLen;
- char *sopref = gn->name;
+ char *name = gn->name;
+ size_t nameLen = strlen(name);
/*
* Begin at the beginning...
@@ -1778,10 +1777,10 @@
if (!(gn->type & OP_PHONY)) {
- SuffFindNormalDepsKnown(nameLen, eoname, gn, sopref, srcs, targs);
+ SuffFindNormalDepsKnown(name, nameLen, gn, srcs, targs);
/* Handle target of unknown suffix... */
- SuffFindNormalDepsUnknown(gn, sopref, srcs, targs);
+ SuffFindNormalDepsUnknown(gn, name, srcs, targs);
/*
* Using the list of possible sources built up from the target
Home |
Main Index |
Thread Index |
Old Index