]> Savannah Git Hosting - gnulib.git/commitdiff
relocatable: avoid compiler warnings (-Wshadow)
authorAkim Demaille <akim.demaille@gmail.com>
Thu, 24 Jan 2019 00:54:22 +0000 (01:54 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 24 Jan 2019 00:54:59 +0000 (01:54 +0100)
* lib/relocatable.c (compute_curr_prefix): Rename local variables
to avoid name collisions with global variables.

ChangeLog
lib/relocatable.c

index f3972fd0825499cb30f068c76cf80624a90a57be..065dcb999da30c2e743c3bcf59366214495a95cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-01-23  Akim Demaille  <akim.demaille@gmail.com>
+            Bruno Haible  <bruno@clisp.org>
+
+       relocatable: avoid compiler warnings (-Wshadow)
+       * lib/relocatable.c (compute_curr_prefix): Rename local variables
+       to avoid name collisions with global variables.
+
 2019-01-22  Bruno Haible  <bruno@clisp.org>
 
        vasnprintf: Don't use %n on Android.
index 17cdb6590f294bfea98fae79ad6e6b581465ba14..de431e765891ef5fcae1768dc0798cdef6c8bc7a 100644 (file)
@@ -268,7 +268,7 @@ compute_curr_prefix (const char *orig_installprefix,
           }
         if (!same)
           break;
-        /* The last pathname component was the same.  opi and cpi now point
+        /* The last pathname component was the same.  rpi and cpi now point
            to the slash before it.  */
         rp = rpi;
         cp = cpi;
@@ -282,23 +282,23 @@ compute_curr_prefix (const char *orig_installprefix,
       }
 
     {
-      size_t curr_prefix_len = cp - curr_installdir;
-      char *curr_prefix;
+      size_t computed_curr_prefix_len = cp - curr_installdir;
+      char *computed_curr_prefix;
 
-      curr_prefix = (char *) xmalloc (curr_prefix_len + 1);
+      computed_curr_prefix = (char *) xmalloc (computed_curr_prefix_len + 1);
 #ifdef NO_XMALLOC
-      if (curr_prefix == NULL)
+      if (computed_curr_prefix == NULL)
         {
           free (curr_installdir);
           return NULL;
         }
 #endif
-      memcpy (curr_prefix, curr_installdir, curr_prefix_len);
-      curr_prefix[curr_prefix_len] = '\0';
+      memcpy (computed_curr_prefix, curr_installdir, computed_curr_prefix_len);
+      computed_curr_prefix[computed_curr_prefix_len] = '\0';
 
       free (curr_installdir);
 
-      return curr_prefix;
+      return computed_curr_prefix;
     }
   }
 }