]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: comm: prefer static initialization
authorCollin Funk <collin.funk1@gmail.com>
Fri, 20 Feb 2026 05:18:41 +0000 (21:18 -0800)
committerCollin Funk <collin.funk1@gmail.com>
Fri, 20 Feb 2026 05:18:41 +0000 (21:18 -0800)
* src/comm.c (only_file_1, only_file_2, both): Initialize variables.
(main): Remove unnecessary initializations.

src/comm.c

index 87cd65eb5b886796d6a37a60eb115f020ae980e5..8e671f40ddeaa800e5cb1fa0e5ef77890a09b983 100644 (file)
 static bool hard_LC_COLLATE;
 
 /* If true, print lines that are found only in file 1. */
-static bool only_file_1;
+static bool only_file_1 = true;
 
 /* If true, print lines that are found only in file 2. */
-static bool only_file_2;
+static bool only_file_2 = true;
 
 /* If true, print lines that are found in both files. */
-static bool both;
+static bool both = true;
 
 /* If nonzero, we have seen at least one unpairable line. */
 static bool seen_unpairable;
@@ -434,15 +434,6 @@ main (int argc, char **argv)
 
   atexit (close_stdout);
 
-  only_file_1 = true;
-  only_file_2 = true;
-  both = true;
-
-  seen_unpairable = false;
-  issued_disorder_warning[0] = issued_disorder_warning[1] = false;
-  check_input_order = CHECK_ORDER_DEFAULT;
-  total_option = false;
-
   while ((c = getopt_long (argc, argv, "123z", long_options, NULL)) != -1)
     switch (c)
       {