Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libcurses/slave Cosmetic fixes. No functional chan...
details: https://anonhg.NetBSD.org/src/rev/a333156bd483
branches: trunk
changeset: 1023335:a333156bd483
user: rin <rin%NetBSD.org@localhost>
date: Sat Sep 04 01:34:32 2021 +0000
description:
Cosmetic fixes. No functional changes intended.
- Reorganize logic to reduce indent levels significantly.
- Use ``for'' rather than ``while''.
diffstat:
tests/lib/libcurses/slave/commands.c | 46 ++++++++++++++++++------------------
1 files changed, 23 insertions(+), 23 deletions(-)
diffs (64 lines):
diff -r cbd6bb03b9ec -r a333156bd483 tests/lib/libcurses/slave/commands.c
--- a/tests/lib/libcurses/slave/commands.c Sat Sep 04 00:33:09 2021 +0000
+++ b/tests/lib/libcurses/slave/commands.c Sat Sep 04 01:34:32 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: commands.c,v 1.15 2021/06/13 12:46:01 rillig Exp $ */
+/* $NetBSD: commands.c,v 1.16 2021/09/04 01:34:32 rin Exp $ */
/*-
* Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -53,32 +53,32 @@
{
size_t i, j;
- i = 0;
- while (i < ncmds) {
- if (strcmp(func, commands[i].name) == 0) {
- /* Check only restricted set of functions is called before
- * initscr/newterm */
- if (!initdone) {
- j = 0;
- while (j < nrcmds) {
- if (strcmp(func, restricted_commands[j]) == 0) {
- if (strcmp(func, "initscr") == 0 ||
- strcmp(func, "newterm") == 0)
- initdone = 1;
- /* matched function */
- commands[i].func(nargs, args);
- return;
- }
- j++;
- }
- report_status("YOU NEED TO CALL INITSCR/NEWTERM FIRST");
- return;
- }
+ for (i = 0; i < ncmds; i++) {
+ if (strcmp(func, commands[i].name) != 0)
+ continue;
+
+ /* Check only restricted set of functions is called before
+ * initscr/newterm */
+ if (initdone) {
/* matched function */
commands[i].func(nargs, args);
return;
}
- i++;
+
+ for (j = 0; j < nrcmds; j++) {
+ if (strcmp(func, restricted_commands[j]) != 0)
+ continue;
+
+ if (strcmp(func, "initscr") == 0 ||
+ strcmp(func, "newterm") == 0)
+ initdone = 1;
+
+ /* matched function */
+ commands[i].func(nargs, args);
+ return;
+ }
+ report_status("YOU NEED TO CALL INITSCR/NEWTERM FIRST");
+ return;
}
report_status("UNKNOWN_FUNCTION");
Home |
Main Index |
Thread Index |
Old Index