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

src/fmt.c

index bb1412057d6328257cea2b4bca779d3e7f8b7955..3f76f6ec681dbbad0f7d774cbc55cb3c5cdc1cae 100644 (file)
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -182,11 +182,11 @@ static bool split;
 static bool uniform;
 
 /* Prefix minus leading and trailing spaces (default "").  */
-static char const *prefix;
+static char const *prefix = "";
 
 /* User-supplied maximum line width (default WIDTH).  The only output
    lines longer than this will each comprise a single word.  */
-static int max_width;
+static int max_width = WIDTH;
 
 /* Values derived from the option values.  */
 
@@ -344,11 +344,6 @@ main (int argc, char **argv)
 
   atexit (close_stdout);
 
-  crown = tagged = split = uniform = false;
-  max_width = WIDTH;
-  prefix = "";
-  prefix_length = prefix_lead_space = prefix_full_length = 0;
-
   if (argc > 1 && argv[1][0] == '-' && c_isdigit (argv[1][1]))
     {
       /* Old option syntax; a dash followed by one or more digits.  */