Module Name:    src
Committed By:   rillig
Date:           Thu Oct  7 23:18:47 UTC 2021

Modified Files:
        src/usr.bin/indent: indent.c indent_globs.h io.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.47 -r1.48 src/usr.bin/indent/indent_globs.h
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/indent/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.124 src/usr.bin/indent/indent.c:1.125
--- src/usr.bin/indent/indent.c:1.124	Thu Oct  7 23:15:15 2021
+++ src/usr.bin/indent/indent.c	Thu Oct  7 23:18:47 2021
@@ -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 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #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 sc_buf[sc_size];
 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 @@ static void
 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 @@ main_init_globals(void)
     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 @@ read_preprocessing_line(void)
 
     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 @@ read_preprocessing_line(void)
 	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 */

Index: src/usr.bin/indent/indent_globs.h
diff -u src/usr.bin/indent/indent_globs.h:1.47 src/usr.bin/indent/indent_globs.h:1.48
--- src/usr.bin/indent/indent_globs.h:1.47	Thu Oct  7 23:15:15 2021
+++ src/usr.bin/indent/indent_globs.h	Thu Oct  7 23:18:47 2021
@@ -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 struct buffer inp;
 
 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 {

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.79 src/usr.bin/indent/io.c:1.80
--- src/usr.bin/indent/io.c:1.79	Thu Oct  7 23:15:15 2021
+++ src/usr.bin/indent/io.c	Thu Oct  7 23:18:47 2021
@@ -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 @@ static char sccsid[] = "@(#)io.c	8.1 (Be
 
 #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 @@ fill_buffer(void)
     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 */

Reply via email to