]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
canonicalize: Reduce scope of local variables.
authorBruno Haible <bruno@clisp.org>
Wed, 10 Dec 2025 18:06:14 +0000 (19:06 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 10 Dec 2025 18:10:21 +0000 (19:10 +0100)
* lib/canonicalize.c (canonicalize_filename_mode_stk): Reduce scope of
'logical', 'num_links', 'end_in_extra_buffer'.

ChangeLog
lib/canonicalize.c

index a813d38413d00c0de1f2822cf1d9fef2c706f458..29c9a04020a33f23d14272a45f11fd487806cd81 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-12-10  Bruno Haible  <bruno@clisp.org>
+
+       canonicalize: Reduce scope of local variables.
+       * lib/canonicalize.c (canonicalize_filename_mode_stk): Reduce scope of
+       'logical', 'num_links', 'end_in_extra_buffer'.
+
 2025-12-10  Pádraig Brady  <P@draigBrady.com>
 
        canonicalize: fix UMR introduced in recent change
index adbccaac8775612189b5ec594394fe9c2d9b83b0..240252fb2cd2bbd3eb7f7a4a26fcb50f95faf96c 100644 (file)
@@ -208,11 +208,7 @@ canonicalize_filename_mode_stk (const char *name, canonicalize_mode_t can_mode,
   char *dest;
   char const *start;
 
-  bool logical = (can_mode & CAN_NOLINKS) != 0;
-
-  int num_links = 0;
   Hash_table *ht = NULL;
-  bool end_in_extra_buffer = false;
   bool failed = true;
 
   if (!IS_ABSOLUTE_FILE_NAME (name))
@@ -278,6 +274,11 @@ canonicalize_filename_mode_stk (const char *name, canonicalize_mode_t can_mode,
       start = name + prefix_len;
     }
 
+  bool logical = (can_mode & CAN_NOLINKS) != 0;
+
+  int num_links = 0;
+  bool end_in_extra_buffer = false;
+
   for (; *start;)
     {
       /* Skip sequence of multiple file name separators.  */