Module Name: src Committed By: rillig Date: Sat Jun 10 13:03:17 UTC 2023
Modified Files: src/usr.bin/indent: debug.c lexi.c Log Message: indent: clean up function names, fix blank lines in debug output To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/usr.bin/indent/debug.c cvs rdiff -u -r1.223 -r1.224 src/usr.bin/indent/lexi.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/debug.c diff -u src/usr.bin/indent/debug.c:1.48 src/usr.bin/indent/debug.c:1.49 --- src/usr.bin/indent/debug.c:1.48 Sat Jun 10 11:01:58 2023 +++ src/usr.bin/indent/debug.c Sat Jun 10 13:03:17 2023 @@ -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) \ Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.223 src/usr.bin/indent/lexi.c:1.224 --- src/usr.bin/indent/lexi.c:1.223 Sat Jun 10 12:59:31 2023 +++ src/usr.bin/indent/lexi.c Sat Jun 10 13:03:17 2023 @@ -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;