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: clean up function names, fix blank li...



details:   https://anonhg.NetBSD.org/src/rev/afb4d08dcfa3
branches:  trunk
changeset: 376320:afb4d08dcfa3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jun 10 13:03:17 2023 +0000

description:
indent: clean up function names, fix blank lines in debug output

diffstat:

 usr.bin/indent/debug.c |   8 ++++----
 usr.bin/indent/lexi.c  |  16 ++++++++--------
 2 files changed, 12 insertions(+), 12 deletions(-)

diffs (101 lines):

diff -r 0b19018a0225 -r afb4d08dcfa3 usr.bin/indent/debug.c
--- a/usr.bin/indent/debug.c    Sat Jun 10 12:59:31 2023 +0000
+++ b/usr.bin/indent/debug.c    Sat Jun 10 13:03:17 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: debug.c,v 1.48 2023/06/10 11:01:58 rillig Exp $        */
+/*     $NetBSD: debug.c,v 1.49 2023/06/10 13:03:17 rillig Exp $        */
 
 /*-
  * Copyright (c) 2023 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: debug.c,v 1.48 2023/06/10 11:01:58 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.49 2023/06/10 13:03:17 rillig Exp $");
 
 #include <stdarg.h>
 #include <string.h>
@@ -287,7 +287,7 @@ debug_ps_paren(void)
        }
        if (ps.nparen == 0)
                debug_printf(" none");
-       debug_blank_line();
+       debug_println("");
 }
 
 static bool
@@ -313,7 +313,7 @@ debug_ps_di_stack(void)
                debug_printf(" %d", ps.di_stack[i]);
        if (ps.decl_level == 0)
                debug_printf(" none");
-       debug_blank_line();
+       debug_println("");
 }
 
 #define debug_ps_bool(name) \
diff -r 0b19018a0225 -r afb4d08dcfa3 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Sat Jun 10 12:59:31 2023 +0000
+++ b/usr.bin/indent/lexi.c     Sat Jun 10 13:03:17 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.223 2023/06/10 12:59:31 rillig Exp $        */
+/*     $NetBSD: lexi.c,v 1.224 2023/06/10 13:03:17 rillig Exp $        */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: lexi.c,v 1.223 2023/06/10 12:59:31 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.224 2023/06/10 13:03:17 rillig Exp $");
 
 #include <stdlib.h>
 #include <string.h>
@@ -313,7 +313,7 @@ cmp_keyword_by_name(const void *key, con
  * this starts a function definition or a declaration.
  */
 static bool
-probably_looking_at_definition(void)
+probably_function_definition(void)
 {
        int paren_level = 0;
        for (const char *p = inp_p; *p != '\n'; p++) {
@@ -418,7 +418,7 @@ found_typename:
        if (inp_p[0] == '(' && ps.psyms.top <= 1 && ps.ind_level == 0 &&
            !ps.in_func_def_params && !ps.in_init) {
 
-               if (ps.nparen == 0 && probably_looking_at_definition()) {
+               if (ps.nparen == 0 && probably_function_definition()) {
                        ps.line_has_func_def = true;
                        if (ps.in_decl)
                                ps.in_func_def_params = true;
@@ -434,7 +434,7 @@ found_typename:
 }
 
 static bool
-is_asterisk_unary(void)
+is_asterisk_pointer(void)
 {
        if (inp_p[strspn(inp_p, "* \t")] == ')')
                return true;
@@ -464,7 +464,7 @@ probably_in_function_definition(void)
 }
 
 static void
-lex_asterisk_unary(void)
+lex_asterisk_pointer(void)
 {
        while (inp_p[0] == '*' || ch_isspace(inp_p[0])) {
                if (inp_p[0] == '*')
@@ -623,8 +623,8 @@ lexi(void)
                if (inp_p[0] == '=') {
                        token_add_char(*inp_p++);
                        lsym = lsym_binary_op;
-               } else if (is_asterisk_unary()) {
-                       lex_asterisk_unary();
+               } else if (is_asterisk_pointer()) {
+                       lex_asterisk_pointer();
                        lsym = lsym_unary_op;
                } else
                        lsym = lsym_binary_op;



Home | Main Index | Thread Index | Old Index