Module Name: src
Committed By: rillig
Date: Tue Feb 23 16:29:52 UTC 2021
Modified Files:
src/usr.bin/make: var.c
Log Message:
make: reduce indentation in Var_Parse
The extra condition had been necessary before FStr made memory
management simpler.
The Coverity annotation got out-of-date when the parameter was converted
to FStr since that type is not allocated on the heap, only its inner
members are.
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.854 -r1.855 src/usr.bin/make/var.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/var.c
diff -u src/usr.bin/make/var.c:1.854 src/usr.bin/make/var.c:1.855
--- src/usr.bin/make/var.c:1.854 Tue Feb 23 16:14:11 2021
+++ src/usr.bin/make/var.c Tue Feb 23 16:29:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.854 2021/02/23 16:14:11 rillig Exp $ */
+/* $NetBSD: var.c,v 1.855 2021/02/23 16:29:52 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.854 2021/02/23 16:14:11 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.855 2021/02/23 16:29:52 rillig Exp $");
typedef enum VarFlags {
VFL_NONE = 0,
@@ -4227,7 +4227,6 @@ FreeEnvVar(Var *v, FStr *inout_val)
* XXX: It is not guaranteed that an error message has
* been printed.
*/
-/* coverity[+alloc : arg-*4] */
VarParseResult
Var_Parse(const char **pp, GNode *scope, VarEvalFlags eflags, FStr *out_val)
{
@@ -4324,16 +4323,14 @@ Var_Parse(const char **pp, GNode *scope,
Expr_SetValueOwn(&expr, expanded);
}
- if (haveModifier || extramodifiers != NULL) {
- if (extramodifiers != NULL) {
- const char *em = extramodifiers;
- ApplyModifiers(&expr, &em, '\0', '\0');
- }
+ if (extramodifiers != NULL) {
+ const char *em = extramodifiers;
+ ApplyModifiers(&expr, &em, '\0', '\0');
+ }
- if (haveModifier) {
- p++; /* Skip initial colon. */
- ApplyModifiers(&expr, &p, startc, endc);
- }
+ if (haveModifier) {
+ p++; /* Skip initial colon. */
+ ApplyModifiers(&expr, &p, startc, endc);
}
if (*p != '\0') /* Skip past endc if possible. */