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 'inbuf' functions to 'inp'



details:   https://anonhg.NetBSD.org/src/rev/83cbf8e045b8
branches:  trunk
changeset: 1024820:83cbf8e045b8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 07 07:06:00 2021 +0000

description:
indent: rename 'inbuf' functions to 'inp'

The variable 'inp' used to be named 'inbuf'. Make the function names
correspond to the variable name again.

No functional change.

diffstat:

 usr.bin/indent/indent.c     |  20 +++++++++---------
 usr.bin/indent/indent.h     |   8 +++---
 usr.bin/indent/io.c         |   6 ++--
 usr.bin/indent/lexi.c       |  46 ++++++++++++++++++++++----------------------
 usr.bin/indent/pr_comment.c |  18 ++++++++--------
 5 files changed, 49 insertions(+), 49 deletions(-)

diffs (truncated from 366 to 300 lines):

diff -r 9e3ab1278321 -r 83cbf8e045b8 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sun Nov 07 01:51:56 2021 +0000
+++ b/usr.bin/indent/indent.c   Sun Nov 07 07:06:00 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.209 2021/11/05 19:42:48 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.210 2021/11/07 07:06:00 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.209 2021/11/05 19:42:48 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.210 2021/11/07 07:06:00 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -320,9 +320,9 @@
     sc_add_char('*');
 
     for (;;) {                 /* loop until the end of the comment */
-       sc_add_char(inbuf_next());
+       sc_add_char(inp_next());
        if (sc_end[-1] == '*' && *inp.s == '/') {
-           sc_add_char(inbuf_next());
+           sc_add_char(inp_next());
            debug_save_com("search_stmt_comment end");
            break;
        }
@@ -345,7 +345,7 @@
         * resulting from the "{" before, it must be scanned now and ignored.
         */
        while (isspace((unsigned char)*inp.s)) {
-           inbuf_skip();
+           inp_skip();
            if (*inp.s == '\n')
                break;
        }
@@ -444,7 +444,7 @@
      */
     if (sc_end != NULL) {
        while (ch_isblank(*inp.s))
-           sc_add_char(inbuf_next());
+           sc_add_char(inp_next());
        debug_save_com(__func__);
     }
 
@@ -627,7 +627,7 @@
 static void
 main_prepare_parsing(void)
 {
-    inbuf_read_line();
+    inp_read_line();
 
     int ind = 0;
     for (const char *p = inp.s;; p++) {
@@ -1246,15 +1246,15 @@
     int com_start = 0, com_end = 0;
 
     while (ch_isblank(*inp.s))
-       inbuf_skip();
+       inp_skip();
 
     while (*inp.s != '\n' || (state == COMM && !had_eof)) {
        buf_reserve(&lab, 2);
-       *lab.e++ = inbuf_next();
+       *lab.e++ = inp_next();
        switch (lab.e[-1]) {
        case '\\':
            if (state != COMM)
-               *lab.e++ = inbuf_next();
+               *lab.e++ = inp_next();
            break;
        case '/':
            if (*inp.s == '*' && state == PLAIN) {
diff -r 9e3ab1278321 -r 83cbf8e045b8 usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Sun Nov 07 01:51:56 2021 +0000
+++ b/usr.bin/indent/indent.h   Sun Nov 07 07:06:00 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.h,v 1.78 2021/11/05 21:39:12 rillig Exp $       */
+/*     $NetBSD: indent.h,v 1.79 2021/11/07 07:06:00 rillig Exp $       */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -367,13 +367,13 @@
 int compute_label_indent(void);
 int ind_add(int, const char *, const char *);
 
-void inbuf_skip(void);
-char inbuf_next(void);
+void inp_skip(void);
+char inp_next(void);
 lexer_symbol lexi(void);
 void diag(int, const char *, ...)__printflike(2, 3);
 void dump_line(void);
 void dump_line_ff(void);
-void inbuf_read_line(void);
+void inp_read_line(void);
 void parse(parser_symbol);
 void parse_stmt_head(stmt_head);
 void process_comment(void);
diff -r 9e3ab1278321 -r 83cbf8e045b8 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Sun Nov 07 01:51:56 2021 +0000
+++ b/usr.bin/indent/io.c       Sun Nov 07 07:06:00 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.115 2021/11/05 21:39:12 rillig Exp $  */
+/*     $NetBSD: io.c,v 1.116 2021/11/07 07:06:00 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.115 2021/11/05 21:39:12 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.116 2021/11/07 07:06:00 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -406,7 +406,7 @@
  * All rights reserved
  */
 void
-inbuf_read_line(void)
+inp_read_line(void)
 {
     char *p;
     int ch;
diff -r 9e3ab1278321 -r 83cbf8e045b8 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Sun Nov 07 01:51:56 2021 +0000
+++ b/usr.bin/indent/lexi.c     Sun Nov 07 07:06:00 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.132 2021/11/05 22:06:43 rillig Exp $        */
+/*     $NetBSD: lexi.c,v 1.133 2021/11/07 07:06:00 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.132 2021/11/05 22:06:43 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.133 2021/11/07 07:06:00 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -179,24 +179,24 @@
 };
 
 static char
-inbuf_peek(void)
+inp_peek(void)
 {
     return *inp.s;
 }
 
 void
-inbuf_skip(void)
+inp_skip(void)
 {
     inp.s++;
     if (inp.s >= inp.e)
-       inbuf_read_line();
+       inp_read_line();
 }
 
 char
-inbuf_next(void)
+inp_next(void)
 {
-    char ch = inbuf_peek();
-    inbuf_skip();
+    char ch = inp_peek();
+    inp_skip();
     return ch;
 }
 
@@ -367,7 +367,7 @@
        }
 
        s = lex_number_state[row][s - 'A'];
-       token_add_char(inbuf_next());
+       token_add_char(inp_next());
     }
 }
 
@@ -382,12 +382,12 @@
            if (inp.s[1] == '\n') {
                inp.s += 2;
                if (inp.s >= inp.e)
-                   inbuf_read_line();
+                   inp_read_line();
            } else
                break;
        }
 
-       token_add_char(inbuf_next());
+       token_add_char(inp_next());
     }
 }
 
@@ -400,14 +400,14 @@
            return;
        }
 
-       token_add_char(inbuf_next());
+       token_add_char(inp_next());
        if (token.e[-1] == delim)
            return;
 
        if (token.e[-1] == '\\') {
            if (*inp.s == '\n')
                ++line_no;
-           token_add_char(inbuf_next());
+           token_add_char(inp_next());
        }
     }
 }
@@ -486,8 +486,8 @@
        (*inp.s == '"' || *inp.s == '\''))
        return lsym_string_prefix;
 
-    while (ch_isblank(inbuf_peek()))
-       inbuf_skip();
+    while (ch_isblank(inp_peek()))
+       inp_skip();
 
     if (ps.prev_token == lsym_tag && ps.p_l_follow == 0) {
        ps.next_unary = true;
@@ -559,7 +559,7 @@
 
     while (ch_isblank(*inp.s)) {
        ps.curr_col_1 = false;
-       inbuf_skip();
+       inp_skip();
     }
 
     lexer_symbol alnum_lsym = lexi_alnum();
@@ -569,7 +569,7 @@
     /* Scan a non-alphanumeric token */
 
     check_size_token(3);       /* for things like "<<=" */
-    *token.e++ = inbuf_next();
+    *token.e++ = inp_next();
     *token.e = '\0';
 
     lexer_symbol lsym;
@@ -686,7 +686,7 @@
     case '<':
     case '!':                  /* ops like <, <<, <=, !=, etc */
        if (*inp.s == '>' || *inp.s == '<' || *inp.s == '=')
-           *token.e++ = inbuf_next();
+           *token.e++ = inp_next();
        if (*inp.s == '=')
            *token.e++ = *inp.s++;
        lsym = ps.next_unary ? lsym_unary_op : lsym_binary_op;
@@ -705,7 +705,7 @@
        while (*inp.s == '*' || isspace((unsigned char)*inp.s)) {
            if (*inp.s == '*')
                token_add_char('*');
-           inbuf_skip();
+           inp_skip();
        }
 
        if (ps.in_decl) {
@@ -714,7 +714,7 @@
            while (isalpha((unsigned char)*tp) ||
                    isspace((unsigned char)*tp)) {
                if (++tp >= inp.e)
-                   inbuf_read_line();
+                   inp_read_line();
            }
            if (*tp == '(')
                ps.procname[0] = ' ';
@@ -725,7 +725,7 @@
 
     default:
        if (token.e[-1] == '/' && (*inp.s == '*' || *inp.s == '/')) {
-           *token.e++ = inbuf_next();
+           *token.e++ = inp_next();
            lsym = lsym_comment;
            unary_delim = ps.next_unary;
            break;
@@ -733,14 +733,14 @@
 
        /* handle '||', '&&', etc., and also things as in 'int *****i' */
        while (token.e[-1] == *inp.s || *inp.s == '=')
-           token_add_char(inbuf_next());
+           token_add_char(inp_next());
 
        lsym = ps.next_unary ? lsym_unary_op : lsym_binary_op;
        unary_delim = true;
     }
 
     if (inp.s >= inp.e)
-       inbuf_read_line();
+       inp_read_line();
 
     ps.next_unary = unary_delim;



Home | Main Index | Thread Index | Old Index