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.
This commit is contained in:
rillig 2022-01-15 19:34:07 +00:00
parent f4552b6621
commit 9c1d64c23c
3 changed files with 11 additions and 30 deletions

View File

@ -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 **pp, bool doEval, const char *func)
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. */

View File

@ -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)

View File

@ -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);
}
/*