]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: touch: reduce variable scope
authorCollin Funk <collin.funk1@gmail.com>
Thu, 5 Mar 2026 07:40:03 +0000 (23:40 -0800)
committerCollin Funk <collin.funk1@gmail.com>
Thu, 5 Mar 2026 07:40:03 +0000 (23:40 -0800)
* src/touch.c (main): Declare variables where they are used instead of
at the start of the function.

src/touch.c

index 1991703b982b30c7c24a30882fbc61f1f481edc4..3d369ee427dc0c5cb82f93ad0442313b5e003b19 100644 (file)
@@ -276,9 +276,7 @@ change the times of the file associated with standard output.\n\
 int
 main (int argc, char **argv)
 {
-  int c;
   bool date_set = false;
-  bool ok = true;
   char const *flex_date = NULL;
 
   initialize_main (&argc, &argv);
@@ -289,6 +287,7 @@ main (int argc, char **argv)
 
   atexit (close_stdout);
 
+  int c;
   while ((c = getopt_long (argc, argv, "acd:fhmr:t:", longopts, NULL)) != -1)
     {
       switch (c)
@@ -446,6 +445,7 @@ main (int argc, char **argv)
       usage (EXIT_FAILURE);
     }
 
+  bool ok = true;
   for (; optind < argc; ++optind)
     ok &= touch (argv[optind]);