aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/make/cond.c
diff options
context:
space:
mode:
authorHartmut Brandt <harti@FreeBSD.org>2005-03-18 15:25:23 +0000
committerHartmut Brandt <harti@FreeBSD.org>2005-03-18 15:25:23 +0000
commit6ea1a0dc217822a883571c773c0dd32ca2a54437 (patch)
treed5a2b3fbe8e3c257925240d5efd23aa981bd11c0 /usr.bin/make/cond.c
parent991f5121f0637956620e0b6e40ac7a03e050a5d3 (diff)
downloadsrc-6ea1a0dc217822a883571c773c0dd32ca2a54437.tar.gz
src-6ea1a0dc217822a883571c773c0dd32ca2a54437.zip
Replace Lst_Find calls with LST_FOREACH loops. This helps in
constification und simplifies the code because the one-liner predicates can be inlined into the code.
Notes
Notes: svn path=/head/; revision=143810
Diffstat (limited to 'usr.bin/make/cond.c')
-rw-r--r--usr.bin/make/cond.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/usr.bin/make/cond.c b/usr.bin/make/cond.c
index 6debeee9ae75..b7df2bf1356a 100644
--- a/usr.bin/make/cond.c
+++ b/usr.bin/make/cond.c
@@ -305,27 +305,6 @@ CondDoDefined(int argLen, char *arg)
/*-
*-----------------------------------------------------------------------
- * CondStrMatch --
- * Front-end for Str_Match so it returns 0 on match and non-zero
- * on mismatch. Callback function for CondDoMake via Lst_Find
- *
- * Results:
- * 0 if string matches pattern
- *
- * Side Effects:
- * None
- *
- *-----------------------------------------------------------------------
- */
-static int
-CondStrMatch(const void *string, const void *pattern)
-{
-
- return (!Str_Match(string, pattern));
-}
-
-/*-
- *-----------------------------------------------------------------------
* CondDoMake --
* Handle the 'make' function for conditionals.
*
@@ -342,12 +321,15 @@ CondDoMake(int argLen, char *arg)
{
char savec = arg[argLen];
Boolean result;
+ const LstNode *ln;
arg[argLen] = '\0';
- if (Lst_Find(&create, arg, CondStrMatch) == NULL) {
- result = FALSE;
- } else {
- result = TRUE;
+ result = FALSE;
+ LST_FOREACH(ln, &create) {
+ if (Str_Match(Lst_Datum(ln), arg)) {
+ result = TRUE;
+ break;
+ }
}
arg[argLen] = savec;
return (result);