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: keep inbuf.save_com_s and inbuf.save_...



details:   https://anonhg.NetBSD.org/src/rev/ad07d4e6cd81
branches:  trunk
changeset: 1026344:ad07d4e6cd81
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Nov 19 20:13:05 2021 +0000

description:
indent: keep inbuf.save_com_s and inbuf.save_com_e in sync

No functional change.

diffstat:

 usr.bin/indent/io.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (53 lines):

diff -r 5a174c7c4e6d -r ad07d4e6cd81 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Fri Nov 19 20:04:02 2021 +0000
+++ b/usr.bin/indent/io.c       Fri Nov 19 20:13:05 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.127 2021/11/19 20:04:02 rillig Exp $  */
+/*     $NetBSD: io.c,v 1.128 2021/11/19 20:13:05 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.127 2021/11/19 20:04:02 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.128 2021/11/19 20:13:05 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -56,7 +56,7 @@
 
 #include "indent.h"
 
-static struct input_buffer {
+static struct {
     struct buffer inp;         /* one line of input, ready to be split into
                                 * tokens; occasionally this buffer switches
                                 * to save_com_buf */
@@ -67,7 +67,7 @@
 
     char *saved_inp_s;         /* saved value of inp.s when taking input from
                                 * save_com */
-    char *saved_inp_e;         /* similarly saved value of inp.e */
+    char *saved_inp_e;         /* saved value of inp.e */
 } inbuf;
 
 static int paren_indent;
@@ -258,7 +258,6 @@
 bool
 inp_comment_seen(void)
 {
-    /* TODO: assert((inbuf.save_com_s != NULL) == (inbuf.save_com_e != NULL)); */
     return inbuf.save_com_e != NULL;
 }
 
@@ -284,7 +283,7 @@
 
     inbuf.inp.s = inbuf.save_com_s;    /* redirect lexi input to save_com_s */
     inbuf.inp.e = inbuf.save_com_e;
-    /* XXX: what about save_com_s? */
+    inbuf.save_com_s = NULL;
     inbuf.save_com_e = NULL;
     debug_inp(__func__);
 }



Home | Main Index | Thread Index | Old Index