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 code for initializing error handli...



details:   https://anonhg.NetBSD.org/src/rev/96707e7c4553
branches:  trunk
changeset: 359466:96707e7c4553
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jan 07 08:28:06 2022 +0000

description:
make: reduce code for initializing error handling in shell

No functional change.

diffstat:

 usr.bin/make/job.c |  14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diffs (35 lines):

diff -r 7d3a07386cf5 -r 96707e7c4553 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Fri Jan 07 08:20:00 2022 +0000
+++ b/usr.bin/make/job.c        Fri Jan 07 08:28:06 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.445 2021/12/27 18:26:22 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.446 2022/01/07 08:28:06 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.445 2021/12/27 18:26:22 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.446 2022/01/07 08:28:06 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -2189,14 +2189,8 @@
                        free(shellErrFlag);
                        shellErrFlag = NULL;
                }
-               if (shellErrFlag == NULL) {
-                       size_t n = strlen(shell->errFlag) + 2;
-
-                       shellErrFlag = bmake_malloc(n);
-                       if (shellErrFlag != NULL)
-                               snprintf(shellErrFlag, n, "-%s",
-                                   shell->errFlag);
-               }
+               if (shellErrFlag == NULL)
+                       shellErrFlag = str_concat2("-", shell->errFlag);
        } else if (shellErrFlag != NULL) {
                free(shellErrFlag);
                shellErrFlag = NULL;



Home | Main Index | Thread Index | Old Index