uniq: prefer static init

* src/uniq.c (skip_fields, skip_chars, check_chars, count_occurrences)
(output_unique, output_first_repeated, output_later_repeated)
(delimit_groups): Initialize statically, rather than in ‘main’.
This shrinks the executable a bit.
This commit is contained in:
Paul Eggert committed 2023-11-16 11:37:25 -08:00
1 parent a72b7823b4
commit 3bee7c9754
1 file changed
+8 -16
+8 -16
View File
@@ -51,24 +51,24 @@
while (0)
/* Number of fields to skip on each line when doing comparisons. */
static idx_t skip_fields;
static idx_t skip_fields = false;
/* Number of chars to skip after skipping any fields. */
static idx_t skip_chars;
static idx_t skip_chars = false;
/* Number of chars to compare. */
static idx_t check_chars;
static idx_t check_chars = IDX_MAX;
/* Whether to precede the output lines with a count of the number of
times they occurred in the input. */
static bool count_occurrences;
static bool count_occurrences = false;
/* Which lines to output: unique lines, the first of a group of
repeated lines, and the second and subsequent of a group of
repeated lines. */
static bool output_unique;
static bool output_first_repeated;
static bool output_later_repeated;
static bool output_unique = true;
static bool output_first_repeated = true;
static bool output_later_repeated = false;
/* If true, ignore case when comparing. */
static bool ignore_case;
@@ -96,7 +96,7 @@ static enum delimit_method const delimit_method_map[] =
};
/* Select whether/how to delimit groups of duplicate lines. */
static enum delimit_method delimit_groups;
static enum delimit_method delimit_groups = DM_NONE;
enum grouping_method
{
@@ -481,14 +481,6 @@ main (int argc, char **argv)
atexit (close_stdout);
skip_chars = 0;
skip_fields = 0;
check_chars = IDX_MAX;
output_unique = output_first_repeated = true;
output_later_repeated = false;
count_occurrences = false;
delimit_groups = DM_NONE;
while (true)
{
/* Parse an operand with leading "+" as a file after "--" was