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: rename bp_save to saved_inp_s, be_sav...



details:   https://anonhg.NetBSD.org/src/rev/9f17963321fe
branches:  trunk
changeset: 988627:9f17963321fe
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 07 23:18:47 2021 +0000

description:
indent: rename bp_save to saved_inp_s, be_save to saved_inp_e

Using the same naming convention makes it easier to relate the
variables.

No functional change.

diffstat:

 usr.bin/indent/indent.c       |  22 +++++++++++-----------
 usr.bin/indent/indent_globs.h |   8 ++++----
 usr.bin/indent/io.c           |  14 +++++++-------
 3 files changed, 22 insertions(+), 22 deletions(-)

diffs (130 lines):

diff -r 60e305d896f4 -r 9f17963321fe usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Thu Oct 07 23:15:15 2021 +0000
+++ b/usr.bin/indent/indent.c   Thu Oct 07 23:18:47 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.124 2021/10/07 23:15:15 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.125 2021/10/07 23:18:47 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.124 2021/10/07 23:15:15 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.125 2021/10/07 23:18:47 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -98,8 +98,8 @@
 char *save_com;
 static char *sc_end;           /* pointer into save_com buffer */
 
-char *bp_save;
-char *be_save;
+char *saved_inp_s;
+char *saved_inp_e;
 
 bool found_err;
 int next_blank_lines;
@@ -276,8 +276,8 @@
 switch_buffer(void)
 {
     ps.search_brace = false;   /* stop looking for start of stmt */
-    bp_save = inp.s;           /* save current input buffer */
-    be_save = inp.e;
+    saved_inp_s = inp.s;               /* save current input buffer */
+    saved_inp_e = inp.e;
     inp.s = save_com;          /* fix so that subsequent calls to lexi will
                                 * take tokens out of save_com */
     *sc_end++ = ' ';           /* add trailing blank, just in case */
@@ -451,8 +451,8 @@
     ps.is_case_label = false;
 
     sc_end = NULL;
-    bp_save = NULL;
-    be_save = NULL;
+    saved_inp_s = NULL;
+    saved_inp_e = NULL;
 
     output = NULL;
 
@@ -1163,7 +1163,7 @@
 
     while (lab.e > lab.s && is_hspace(lab.e[-1]))
        lab.e--;
-    if (lab.e - lab.s == com_end && bp_save == NULL) {
+    if (lab.e - lab.s == com_end && saved_inp_s == NULL) {
        /* comment on preprocessor line */
        if (sc_end == NULL) {   /* if this is the first comment, we must set
                                 * up the buffer */
@@ -1181,8 +1181,8 @@
        lab.e = lab.s + com_start;
        while (lab.e > lab.s && is_hspace(lab.e[-1]))
            lab.e--;
-       bp_save = inp.s;        /* save current input buffer */
-       be_save = inp.e;
+       saved_inp_s = inp.s;    /* save current input buffer */
+       saved_inp_e = inp.e;
        inp.s = save_com;       /* fix so that subsequent calls to lexi will
                                 * take tokens out of save_com */
        *sc_end++ = ' ';        /* add trailing blank, just in case */
diff -r 60e305d896f4 -r 9f17963321fe usr.bin/indent/indent_globs.h
--- a/usr.bin/indent/indent_globs.h     Thu Oct 07 23:15:15 2021 +0000
+++ b/usr.bin/indent/indent_globs.h     Thu Oct 07 23:18:47 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent_globs.h,v 1.47 2021/10/07 23:15:15 rillig Exp $ */
+/*     $NetBSD: indent_globs.h,v 1.48 2021/10/07 23:18:47 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -64,11 +64,11 @@
 
 extern char        sc_buf[sc_size];    /* input text is saved here when looking for
                                 * the brace after an if, while, etc */
-extern char       *save_com;           /* start of the comment stored in sc_buf */
+extern char       *save_com;   /* start of the comment stored in sc_buf */
 
-extern char       *bp_save;            /* saved value of inp.s when taking input
+extern char       *saved_inp_s;        /* saved value of inp.s when taking input
                                 * from save_com */
-extern char       *be_save;            /* similarly saved value of inp.e */
+extern char       *saved_inp_e;        /* similarly saved value of inp.e */
 
 
 extern struct options {
diff -r 60e305d896f4 -r 9f17963321fe usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Thu Oct 07 23:15:15 2021 +0000
+++ b/usr.bin/indent/io.c       Thu Oct 07 23:18:47 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.79 2021/10/07 23:15:15 rillig Exp $   */
+/*     $NetBSD: io.c,v 1.80 2021/10/07 23:18:47 rillig Exp $   */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.79 2021/10/07 23:15:15 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.80 2021/10/07 23:18:47 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -410,11 +410,11 @@
     int ch;
     FILE *f = input;
 
-    if (bp_save != NULL) {     /* there is a partly filled input buffer left */
-       inp.s = bp_save;        /* do not read anything, just switch buffers */
-       inp.e = be_save;
-       bp_save = be_save = NULL;
-       debug_println("switched inp.s back to bp_save");
+    if (saved_inp_s != NULL) { /* there is a partly filled input buffer left */
+       inp.s = saved_inp_s;    /* do not read anything, just switch buffers */
+       inp.e = saved_inp_e;
+       saved_inp_s = saved_inp_e = NULL;
+       debug_println("switched inp.s back to saved_inp_s");
        if (inp.s < inp.e)
            return;             /* only return if there is really something in
                                 * this buffer */



Home | Main Index | Thread Index | Old Index