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: reduce indentation in Var_Parse



details:   https://anonhg.NetBSD.org/src/rev/fddd0586acd4
branches:  trunk
changeset: 959758:fddd0586acd4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Feb 23 16:29:52 2021 +0000

description:
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.

diffstat:

 usr.bin/make/var.c |  23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diffs (51 lines):

diff -r 96044f0e8ba6 -r fddd0586acd4 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Tue Feb 23 16:14:11 2021 +0000
+++ b/usr.bin/make/var.c        Tue Feb 23 16:29:52 2021 +0000
@@ -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 @@
  *                     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 @@
                Expr_SetValueOwn(&expr, expanded);
        }
 
-       if (haveModifier || extramodifiers != NULL) {
-               if (extramodifiers != NULL) {
-                       const char *em = extramodifiers;
-                       ApplyModifiers(&expr, &em, '\0', '\0');
-               }
-
-               if (haveModifier) {
-                       p++;    /* Skip initial colon. */
-                       ApplyModifiers(&expr, &p, startc, endc);
-               }
+       if (extramodifiers != NULL) {
+               const char *em = extramodifiers;
+               ApplyModifiers(&expr, &em, '\0', '\0');
+       }
+
+       if (haveModifier) {
+               p++;    /* Skip initial colon. */
+               ApplyModifiers(&expr, &p, startc, endc);
        }
 
        if (*p != '\0')         /* Skip past endc if possible. */



Home | Main Index | Thread Index | Old Index