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 fill_buffer to inbuf_read_line



details:   https://anonhg.NetBSD.org/src/rev/24e06c1b08db
branches:  trunk
changeset: 988659:24e06c1b08db
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 08 21:13:58 2021 +0000

description:
indent: rename fill_buffer to inbuf_read_line

No functional change.

diffstat:

 usr.bin/indent/indent.c     |   8 ++++----
 usr.bin/indent/indent.h     |   4 ++--
 usr.bin/indent/io.c         |  15 ++++++---------
 usr.bin/indent/lexi.c       |  13 ++++++-------
 usr.bin/indent/pr_comment.c |   6 +++---
 5 files changed, 21 insertions(+), 25 deletions(-)

diffs (186 lines):

diff -r 573f200adce6 -r 24e06c1b08db usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Fri Oct 08 20:45:22 2021 +0000
+++ b/usr.bin/indent/indent.c   Fri Oct 08 21:13:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.132 2021/10/08 20:45:22 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.133 2021/10/08 21:13:58 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.132 2021/10/08 20:45:22 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.133 2021/10/08 21:13:58 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -314,7 +314,7 @@
                errx(1, "input too long");
        }
        if (inp.s >= inp.e)
-           fill_buffer();
+           inbuf_read_line();
     }
 
     struct parser_state transient_state;
@@ -567,7 +567,7 @@
 static void
 main_prepare_parsing(void)
 {
-    fill_buffer();             /* get first batch of stuff into input buffer */
+    inbuf_read_line();
 
     parse(semicolon);
 
diff -r 573f200adce6 -r 24e06c1b08db usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Fri Oct 08 20:45:22 2021 +0000
+++ b/usr.bin/indent/indent.h   Fri Oct 08 21:13:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.h,v 1.34 2021/10/08 19:03:34 rillig Exp $       */
+/*     $NetBSD: indent.h,v 1.35 2021/10/08 21:13:58 rillig Exp $       */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -353,7 +353,7 @@
 token_type lexi(struct parser_state *);
 void diag(int, const char *, ...)__printflike(2, 3);
 void dump_line(void);
-void fill_buffer(void);
+void inbuf_read_line(void);
 void parse(token_type);
 void process_comment(void);
 void set_option(const char *, const char *);
diff -r 573f200adce6 -r 24e06c1b08db usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Fri Oct 08 20:45:22 2021 +0000
+++ b/usr.bin/indent/io.c       Fri Oct 08 21:13:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.88 2021/10/08 19:03:34 rillig Exp $   */
+/*     $NetBSD: io.c,v 1.89 2021/10/08 21:13:58 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.88 2021/10/08 19:03:34 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.89 2021/10/08 21:13:58 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -408,13 +408,10 @@
  * Copyright (C) 1976 by the Board of Trustees of the University of Illinois
  *
  * All rights reserved
- *
- * FUNCTION: Reads one block of input into the input buffer
  */
 void
-fill_buffer(void)
+inbuf_read_line(void)
 {
-    /* this routine reads stuff from the input */
     char *p;
     int ch;
     FILE *f = input;
@@ -454,9 +451,9 @@
     inp.s = inp.buf;
     inp.e = p;
 
-    if (p - inp.buf > 2 && p[-2] == '/' && p[-3] == '*') {
-       if (inp.buf[3] == 'I' && strncmp(inp.buf, "/**INDENT**", 11) == 0)
-           fill_buffer();      /* flush indent error message */
+    if (p - inp.buf >= 3 && p[-3] == '*' && p[-2] == '/') {
+       if (strncmp(inp.buf, "/**INDENT**", 11) == 0)
+           inbuf_read_line();  /* flush indent error message */
        else
            parse_indent_comment();
     }
diff -r 573f200adce6 -r 24e06c1b08db usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Fri Oct 08 20:45:22 2021 +0000
+++ b/usr.bin/indent/lexi.c     Fri Oct 08 21:13:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.80 2021/10/08 19:22:19 rillig Exp $ */
+/*     $NetBSD: lexi.c,v 1.81 2021/10/08 21:13:58 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.80 2021/10/08 19:22:19 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.81 2021/10/08 21:13:58 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -187,7 +187,7 @@
 {
     inp.s++;
     if (inp.s >= inp.e)
-       fill_buffer();
+       inbuf_read_line();
 }
 
 char
@@ -295,12 +295,11 @@
           *inp.s == '\\' ||
           *inp.s == '_' || *inp.s == '$') {
 
-       /* fill_buffer() terminates buffer with newline */
        if (*inp.s == '\\') {
            if (inp.s[1] == '\n') {
                inp.s += 2;
                if (inp.s >= inp.e)
-                   fill_buffer();
+                   inbuf_read_line();
            } else
                break;
        }
@@ -656,7 +655,7 @@
            while (isalpha((unsigned char)*tp) ||
                   isspace((unsigned char)*tp)) {
                if (++tp >= inp.e)
-                   fill_buffer();
+                   inbuf_read_line();
            }
            if (*tp == '(')
                ps.procname[0] = ' ';
@@ -688,7 +687,7 @@
     }
 
     if (inp.s >= inp.e)        /* check for input buffer empty */
-       fill_buffer();
+       inbuf_read_line();
 
     state->last_u_d = unary_delim;
 
diff -r 573f200adce6 -r 24e06c1b08db usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Fri Oct 08 20:45:22 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Fri Oct 08 21:13:58 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.63 2021/10/08 19:03:34 rillig Exp $   */
+/*     $NetBSD: pr_comment.c,v 1.64 2021/10/08 21:13:58 rillig Exp $   */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.63 2021/10/08 19:03:34 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.64 2021/10/08 21:13:58 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -177,7 +177,7 @@
     if (break_delim) {
        for (const char *p = inp.s; *p != '\0' && *p != '\n'; p++) {
            if (p >= inp.e)
-               fill_buffer();
+               inbuf_read_line();
            if (p[0] == '*' && p[1] == '/') {
                /*
                 * XXX: This computation ignores the leading " * ", as well as



Home | Main Index | Thread Index | Old Index