Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/indent indent: inline macro for backslash



details:   https://anonhg.NetBSD.org/src/rev/ac2c611f582a
branches:  trunk
changeset: 953429:ac2c611f582a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Mar 08 20:20:11 2021 +0000

description:
indent: inline macro for backslash

No functional change.

diffstat:

 usr.bin/indent/indent.c       |   6 +++---
 usr.bin/indent/indent_globs.h |   3 +--
 usr.bin/indent/lexi.c         |  10 +++++-----
 3 files changed, 9 insertions(+), 10 deletions(-)

diffs (84 lines):

diff -r ded518adff65 -r ac2c611f582a usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Mon Mar 08 20:15:42 2021 +0000
+++ b/usr.bin/indent/indent.c   Mon Mar 08 20:20:11 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.34 2021/03/08 20:15:42 rillig Exp $       */
+/*     $NetBSD: indent.c,v 1.35 2021/03/08 20:20:11 rillig Exp $       */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.34 2021/03/08 20:15:42 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.35 2021/03/08 20:20:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -1177,7 +1177,7 @@
                    if (buf_ptr >= buf_end)
                        fill_buffer();
                    switch (*e_lab++) {
-                   case BACKSLASH:
+                   case '\\':
                        if (!in_comment) {
                            *e_lab++ = *buf_ptr++;
                            if (buf_ptr >= buf_end)
diff -r ded518adff65 -r ac2c611f582a usr.bin/indent/indent_globs.h
--- a/usr.bin/indent/indent_globs.h     Mon Mar 08 20:15:42 2021 +0000
+++ b/usr.bin/indent/indent_globs.h     Mon Mar 08 20:20:11 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent_globs.h,v 1.16 2021/03/08 20:15:42 rillig Exp $ */
+/*     $NetBSD: indent_globs.h,v 1.17 2021/03/08 20:20:11 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -40,7 +40,6 @@
  * $FreeBSD: head/usr.bin/indent/indent_globs.h 337651 2018-08-11 19:20:06Z pstef $
  */
 
-#define BACKSLASH '\\'
 #define bufsize 200            /* size of internal buffers */
 #define sc_size 5000           /* size of save_com buffer */
 #define label_offset 2         /* number of levels a label is placed to left
diff -r ded518adff65 -r ac2c611f582a usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Mon Mar 08 20:15:42 2021 +0000
+++ b/usr.bin/indent/lexi.c     Mon Mar 08 20:20:11 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.25 2021/03/08 20:15:42 rillig Exp $ */
+/*     $NetBSD: lexi.c,v 1.26 2021/03/08 20:20:11 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.25 2021/03/08 20:15:42 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.26 2021/03/08 20:20:11 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -301,10 +301,10 @@
        }
        else
            while (isalnum((unsigned char)*buf_ptr) ||
-               *buf_ptr == BACKSLASH ||
+               *buf_ptr == '\\' ||
                *buf_ptr == '_' || *buf_ptr == '$') {
                /* fill_buffer() terminates buffer with newline */
-               if (*buf_ptr == BACKSLASH) {
+               if (*buf_ptr == '\\') {
                    if (*(buf_ptr + 1) == '\n') {
                        buf_ptr += 2;
                        if (buf_ptr >= buf_end)
@@ -467,7 +467,7 @@
                *e_token = *buf_ptr++;
                if (buf_ptr >= buf_end)
                    fill_buffer();
-               if (*e_token == BACKSLASH) {    /* if escape, copy extra char */
+               if (*e_token == '\\') {         /* if escape, copy extra char */
                    if (*buf_ptr == '\n')       /* check for escaped newline */
                        ++line_no;
                    *++e_token = *buf_ptr++;



Home | Main Index | Thread Index | Old Index