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: remove unnecessary variable size opti...



details:   https://anonhg.NetBSD.org/src/rev/948f73026336
branches:  trunk
changeset: 375872:948f73026336
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu May 18 03:38:34 2023 +0000

description:
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.

diffstat:

 usr.bin/indent/indent.c |  6 +++---
 usr.bin/indent/indent.h |  4 ++--
 usr.bin/indent/io.c     |  6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 39151ef3e56d -r 948f73026336 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Thu May 18 00:28:37 2023 +0000
+++ b/usr.bin/indent/indent.c   Thu May 18 03:38:34 2023 +0000
@@ -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);
diff -r 39151ef3e56d -r 948f73026336 usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Thu May 18 00:28:37 2023 +0000
+++ b/usr.bin/indent/indent.h   Thu May 18 03:38:34 2023 +0000
@@ -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 {
diff -r 39151ef3e56d -r 948f73026336 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Thu May 18 00:28:37 2023 +0000
+++ b/usr.bin/indent/io.c       Thu May 18 03:38:34 2023 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index