Module Name: src Committed By: rillig Date: Sat Jan 15 19:34:07 UTC 2022
Modified Files: src/usr.bin/make: cond.c main.c meta.c Log Message: make: replace Var_Value with Var_Exists where applicable The latter function already existed in 1993, no idea why it was not used. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.325 -r1.326 src/usr.bin/make/cond.c cvs rdiff -u -r1.571 -r1.572 src/usr.bin/make/main.c cvs rdiff -u -r1.191 -r1.192 src/usr.bin/make/meta.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/cond.c diff -u src/usr.bin/make/cond.c:1.325 src/usr.bin/make/cond.c:1.326 --- src/usr.bin/make/cond.c:1.325 Fri Jan 14 18:25:22 2022 +++ src/usr.bin/make/cond.c Sat Jan 15 19:34:07 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.325 2022/01/14 18:25:22 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.326 2022/01/15 19:34:07 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -95,7 +95,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.325 2022/01/14 18:25:22 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.326 2022/01/15 19:34:07 rillig Exp $"); /* * Conditional expressions conform to this grammar: @@ -290,10 +290,7 @@ ParseFuncArg(CondParser *par, const char static bool FuncDefined(const char *var) { - FStr value = Var_Value(SCOPE_CMDLINE, var); - bool result = value.str != NULL; - FStr_Done(&value); - return result; + return Var_Exists(SCOPE_CMDLINE, var); } /* See if the given target is requested to be made. */ Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.571 src/usr.bin/make/main.c:1.572 --- src/usr.bin/make/main.c:1.571 Sat Jan 15 19:05:23 2022 +++ src/usr.bin/make/main.c Sat Jan 15 19:34:07 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.571 2022/01/15 19:05:23 rillig Exp $ */ +/* $NetBSD: main.c,v 1.572 2022/01/15 19:34:07 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -111,7 +111,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.571 2022/01/15 19:05:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.572 2022/01/15 19:34:07 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1018,17 +1018,14 @@ static void HandlePWD(const struct stat *curdir_st) { char *pwd; - FStr prefix, makeobjdir; + FStr makeobjdir; struct stat pwd_st; if (ignorePWD || (pwd = getenv("PWD")) == NULL) return; - prefix = Var_Value(SCOPE_CMDLINE, "MAKEOBJDIRPREFIX"); - if (prefix.str != NULL) { - FStr_Done(&prefix); + if (Var_Exists(SCOPE_CMDLINE, "MAKEOBJDIRPREFIX")) return; - } makeobjdir = Var_Value(SCOPE_CMDLINE, "MAKEOBJDIR"); if (makeobjdir.str != NULL && strchr(makeobjdir.str, '$') != NULL) Index: src/usr.bin/make/meta.c diff -u src/usr.bin/make/meta.c:1.191 src/usr.bin/make/meta.c:1.192 --- src/usr.bin/make/meta.c:1.191 Sat Jan 15 19:05:23 2022 +++ src/usr.bin/make/meta.c Sat Jan 15 19:34:07 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: meta.c,v 1.191 2022/01/15 19:05:23 rillig Exp $ */ +/* $NetBSD: meta.c,v 1.192 2022/01/15 19:34:07 rillig Exp $ */ /* * Implement 'meta' mode. @@ -591,7 +591,6 @@ meta_mode_init(const char *make_mode) { static bool once = false; const char *cp; - FStr value; useMeta = true; useFilemon = true; @@ -648,21 +647,9 @@ meta_mode_init(const char *make_mode) /* * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS} */ - value = Var_Value(SCOPE_GLOBAL, MAKE_META_IGNORE_PATTERNS); - if (value.str != NULL) { - metaIgnorePatterns = true; - FStr_Done(&value); - } - value = Var_Value(SCOPE_GLOBAL, MAKE_META_IGNORE_FILTER); - if (value.str != NULL) { - metaIgnoreFilter = true; - FStr_Done(&value); - } - value = Var_Value(SCOPE_GLOBAL, MAKE_META_CMP_FILTER); - if (value.str != NULL) { - metaCmpFilter = true; - FStr_Done(&value); - } + metaIgnorePatterns = Var_Exists(SCOPE_GLOBAL, MAKE_META_IGNORE_PATTERNS); + metaIgnoreFilter = Var_Exists(SCOPE_GLOBAL, MAKE_META_IGNORE_FILTER); + metaCmpFilter = Var_Exists(SCOPE_GLOBAL, MAKE_META_CMP_FILTER); } /*