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: initialize 'ps' via code
details: https://anonhg.NetBSD.org/src/rev/fa83431d6076
branches: trunk
changeset: 990522:fa83431d6076
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Oct 29 19:31:24 2021 +0000
description:
indent: initialize 'ps' via code
This saves 3 kB of binary size since the parser state is rather large
and only very few members are initialized to non-zero values.
No functional change.
diffstat:
usr.bin/indent/indent.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (42 lines):
diff -r f39eb7c8bad6 -r fa83431d6076 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c Fri Oct 29 19:27:06 2021 +0000
+++ b/usr.bin/indent/indent.c Fri Oct 29 19:31:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.174 2021/10/29 19:22:55 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.175 2021/10/29 19:31:24 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.174 2021/10/29 19:22:55 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.175 2021/10/29 19:31:24 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
#endif
@@ -85,11 +85,7 @@
.use_tabs = true,
};
-struct parser_state ps = {
- .s_sym[0] = psym_stmt,
- .prev_token = lsym_semicolon,
- .prev_newline = true,
-};
+struct parser_state ps;
struct buffer lab;
struct buffer code;
@@ -469,6 +465,10 @@
buf_init(&lab);
buf_init(&code);
+ ps.s_sym[0] = psym_stmt;
+ ps.prev_token = lsym_semicolon;
+ ps.prev_newline = true;
+
const char *suffix = getenv("SIMPLE_BACKUP_SUFFIX");
if (suffix != NULL)
backup_suffix = suffix;
Home |
Main Index |
Thread Index |
Old Index