Module Name: src Committed By: rillig Date: Thu May 18 03:38:34 UTC 2023
Modified Files: src/usr.bin/indent: indent.c indent.h io.c Log Message: indent: remove unnecessary variable size optimization Due to the enum that follows in the struct, the short variable was padded to 4 bytes anyway. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.290 -r1.291 src/usr.bin/indent/indent.c cvs rdiff -u -r1.146 -r1.147 src/usr.bin/indent/indent.h cvs rdiff -u -r1.175 -r1.176 src/usr.bin/indent/io.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/indent.c diff -u src/usr.bin/indent/indent.c:1.290 src/usr.bin/indent/indent.c:1.291 --- src/usr.bin/indent/indent.c:1.290 Tue May 16 13:26:26 2023 +++ src/usr.bin/indent/indent.c Thu May 18 03:38:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.290 2023/05/16 13:26:26 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.291 2023/05/18 03:38:34 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: indent.c,v 1.290 2023/05/16 13:26:26 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.291 2023/05/18 03:38:34 rillig Exp $"); #include <sys/param.h> #include <err.h> @@ -477,7 +477,7 @@ process_lparen_or_lbracket(void) || ps.is_function_definition) cast = cast_no; - ps.paren[ps.nparen - 1].indent = (short)indent; + ps.paren[ps.nparen - 1].indent = indent; ps.paren[ps.nparen - 1].cast = cast; debug_println("paren_indents[%d] is now %s%d", ps.nparen - 1, paren_level_cast_name[cast], indent); Index: src/usr.bin/indent/indent.h diff -u src/usr.bin/indent/indent.h:1.146 src/usr.bin/indent/indent.h:1.147 --- src/usr.bin/indent/indent.h:1.146 Tue May 16 13:26:26 2023 +++ src/usr.bin/indent/indent.h Thu May 18 03:38:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.h,v 1.146 2023/05/16 13:26:26 rillig Exp $ */ +/* $NetBSD: indent.h,v 1.147 2023/05/18 03:38:34 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD @@ -247,7 +247,7 @@ extern enum indent_enabled { /* Properties of each level of parentheses or brackets. */ typedef struct paren_level_props { - short indent; /* indentation of the operand/argument, + int indent; /* indentation of the operand/argument, * relative to the enclosing statement; if * negative, reflected at -1 */ enum paren_level_cast { Index: src/usr.bin/indent/io.c diff -u src/usr.bin/indent/io.c:1.175 src/usr.bin/indent/io.c:1.176 --- src/usr.bin/indent/io.c:1.175 Tue May 16 13:26:26 2023 +++ src/usr.bin/indent/io.c Thu May 18 03:38:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.175 2023/05/16 13:26:26 rillig Exp $ */ +/* $NetBSD: io.c,v 1.176 2023/05/18 03:38:34 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: io.c,v 1.175 2023/05/16 13:26:26 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.176 2023/05/18 03:38:34 rillig Exp $"); #include <stdio.h> #include <string.h> @@ -152,7 +152,7 @@ output_line_code(int ind) for (int i = 0; i < ps.nparen; i++) { int paren_ind = ps.paren[i].indent; if (paren_ind >= 0) { - ps.paren[i].indent = (short)(-1 - (paren_ind + target_ind)); + ps.paren[i].indent = -1 - (paren_ind + target_ind); debug_println( "setting paren_indents[%d] from %d to %d for column %d", i, paren_ind, ps.paren[i].indent, target_ind + 1);