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: untangle output handling in jobs mode, re...
details: https://anonhg.NetBSD.org/src/rev/14190b1bd16a
branches: trunk
changeset: 369843:14190b1bd16a
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Sep 03 08:41:07 2022 +0000
description:
make: untangle output handling in jobs mode, remove redundant braces
No functional change.
diffstat:
usr.bin/make/job.c | 24 +++++++++---------------
1 files changed, 9 insertions(+), 15 deletions(-)
diffs (63 lines):
diff -r ec881edfc80e -r 14190b1bd16a usr.bin/make/job.c
--- a/usr.bin/make/job.c Sat Sep 03 08:03:27 2022 +0000
+++ b/usr.bin/make/job.c Sat Sep 03 08:41:07 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.454 2022/09/03 08:03:27 rillig Exp $ */
+/* $NetBSD: job.c,v 1.455 2022/09/03 08:41:07 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.454 2022/09/03 08:03:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.455 2022/09/03 08:41:07 rillig Exp $");
/*
* A shell defines how the commands are run. All commands for a target are
@@ -1836,37 +1836,31 @@
if (nRead < 0) {
if (errno == EAGAIN)
return;
- if (DEBUG(JOB)) {
+ if (DEBUG(JOB))
perror("CollectOutput(piperead)");
- }
nr = 0;
- } else {
+ } else
nr = (size_t)nRead;
- }
+
+ if (nr == 0)
+ finish = false; /* stop looping */
/*
* If we hit the end-of-file (the job is dead), we must flush its
* remaining output, so pretend we read a newline if there's any
* output remaining in the buffer.
- * Also clear the 'finish' flag so we stop looping.
*/
if (nr == 0 && job->curPos != 0) {
job->outBuf[job->curPos] = '\n';
nr = 1;
- finish = false;
- } else if (nr == 0) {
- finish = false;
}
- /*
- * Look for the last newline in the bytes we just got. If there is
- * one, break out of the loop with 'i' as its index and gotNL set
- * true.
- */
max = job->curPos + nr;
for (i = job->curPos; i < max; i++)
if (job->outBuf[i] == '\0')
job->outBuf[i] = ' ';
+
+ /* Look for the last newline in the bytes we just got. */
for (i = job->curPos + nr - 1;
i >= job->curPos && i != (size_t)-1; i--) {
if (job->outBuf[i] == '\n') {
Home |
Main Index |
Thread Index |
Old Index