Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh sh: remove useless do-while-0 loop
details: https://anonhg.NetBSD.org/src/rev/63eb45048f6d
branches: trunk
changeset: 1024122:63eb45048f6d
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Oct 10 18:46:25 2021 +0000
description:
sh: remove useless do-while-0 loop
28 years was more than enough for the useless 'continue' statement in
this do-while-0 "loop". Without the 'continue' statement, there is no
need for the "loop" anymore. The comment at its top was confusing since
the word 'while' suggested a loop, but there was none, so remove that as
well.
Pointed out by Tom Ivar Helbekkmo on source-changes-d.
No change to the resulting binary.
diffstat:
bin/sh/jobs.c | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
diffs (46 lines):
diff -r fba86c150a43 -r 63eb45048f6d bin/sh/jobs.c
--- a/bin/sh/jobs.c Sun Oct 10 18:16:12 2021 +0000
+++ b/bin/sh/jobs.c Sun Oct 10 18:46:25 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: jobs.c,v 1.113 2021/10/10 08:35:34 rillig Exp $ */
+/* $NetBSD: jobs.c,v 1.114 2021/10/10 18:46:25 rillig Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: jobs.c,v 1.113 2021/10/10 08:35:34 rillig Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.114 2021/10/10 18:46:25 rillig Exp $");
#endif
#endif /* not lint */
@@ -187,18 +187,16 @@
out2str("sh: Need FIOCLEX or FD_CLOEXEC to support job control");
goto out;
#endif
- do { /* while we are in the background */
- if ((initialpgrp = tcgetpgrp(ttyfd)) < 0) {
+ if ((initialpgrp = tcgetpgrp(ttyfd)) < 0) {
out:
- out2str("sh: can't access tty; job control turned off\n");
- mflag = 0;
- return;
- }
- if (initialpgrp == -1)
- initialpgrp = getpgrp();
- else if (initialpgrp != getpgrp())
- killpg(0, SIGTTIN);
- } while (0);
+ out2str("sh: can't access tty; job control turned off\n");
+ mflag = 0;
+ return;
+ }
+ if (initialpgrp == -1)
+ initialpgrp = getpgrp();
+ else if (initialpgrp != getpgrp())
+ killpg(0, SIGTTIN);
#ifdef OLD_TTY_DRIVER
if (ioctl(ttyfd, TIOCGETD, (char *)&ldisc) < 0
Home |
Main Index |
Thread Index |
Old Index