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/1846b447fb80
branches:  trunk
changeset: 953023:1846b447fb80
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 7a8a29247c14 -r 1846b447fb80 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