Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libcurses/director tests/libcurses: reduce indenta...



details:   https://anonhg.NetBSD.org/src/rev/638363d60152
branches:  trunk
changeset: 959784:638363d60152
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Feb 25 00:32:44 2021 +0000

description:
tests/libcurses: reduce indentation

No functional change.

diffstat:

 tests/lib/libcurses/director/testlang_conf.l |  72 ++++++++++++++-------------
 1 files changed, 37 insertions(+), 35 deletions(-)

diffs (99 lines):

diff -r 3e603375bfb6 -r 638363d60152 tests/lib/libcurses/director/testlang_conf.l
--- a/tests/lib/libcurses/director/testlang_conf.l      Thu Feb 25 00:26:57 2021 +0000
+++ b/tests/lib/libcurses/director/testlang_conf.l      Thu Feb 25 00:32:44 2021 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: testlang_conf.l,v 1.22 2021/02/25 00:25:31 rillig Exp $        */
+/*     $NetBSD: testlang_conf.l,v 1.23 2021/02/25 00:32:44 rillig Exp $        */
 
 /*-
  * Copyright 2009 Brett Lymn <blymn%NetBSD.org@localhost>
@@ -79,6 +79,7 @@
        while (*p) {
                if (*p == '\\' && *(p+1)) {
                        ++p;
+
                        if (isdigit(*p)) {
                                if (*(p+1) && isdigit(*(p+1)) && *(p+2) &&
                                    isdigit(*(p+2))) {
@@ -87,45 +88,46 @@
                                } else {
                                        *q++ = *p++;
                                }
-                       } else {
-                               switch (*p) {
-                               case 'e':
-                                       /* escape */
-                                       *q++ = '\e';
-                                       p++;
-                                       break;
+                               continue;
+                       }
 
-                               case 'n':
-                                       /* newline */
-                                       *q++ = '\n';
-                                       p++;
-                                       break;
+                       switch (*p) {
+                       case 'e':
+                               /* escape */
+                               *q++ = '\e';
+                               p++;
+                               break;
 
-                               case 'r':
-                                       /* carriage return */
-                                       *q++ = '\r';
-                                       p++;
-                                       break;
+                       case 'n':
+                               /* newline */
+                               *q++ = '\n';
+                               p++;
+                               break;
 
-                               case 't':
-                                       /* tab */
-                                       *q++ = '\t';
-                                       p++;
-                                       break;
+                       case 'r':
+                               /* carriage return */
+                               *q++ = '\r';
+                               p++;
+                               break;
+
+                       case 't':
+                               /* tab */
+                               *q++ = '\t';
+                               p++;
+                               break;
 
-                               case '\\':
-                                       /* backslash */
-                                       *q++ = '\\';
-                                       p++;
-                                       break;
+                       case '\\':
+                               /* backslash */
+                               *q++ = '\\';
+                               p++;
+                               break;
 
-                               default:
-                                       if (isalpha((unsigned char)*p))
-                                               errx(2,
-                                                   "%s:%zu: invalid escape sequence '\\%c' in string literal",
-                                                   cur_file, line, *p);
-                                       *q++ = *p++;
-                               }
+                       default:
+                               if (isalpha(*p))
+                                       errx(2,
+                                           "%s:%zu: invalid escape sequence '\\%c' in string literal",
+                                           cur_file, line, *p);
+                               *q++ = *p++;
                        }
                } else
                        *q++ = *p++;



Home | Main Index | Thread Index | Old Index