From 7b56f157a32c5aab6bd65a49c55e18113ad83e3e Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 24 Jan 2019 01:54:22 +0100 Subject: [PATCH] relocatable: avoid compiler warnings (-Wshadow) * lib/relocatable.c (compute_curr_prefix): Rename local variables to avoid name collisions with global variables. --- ChangeLog | 7 +++++++ lib/relocatable.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index f3972fd082..065dcb999d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-01-23 Akim Demaille + Bruno Haible + + 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 vasnprintf: Don't use %n on Android. diff --git a/lib/relocatable.c b/lib/relocatable.c index 17cdb6590f..de431e7658 100644 --- a/lib/relocatable.c +++ b/lib/relocatable.c @@ -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; } } } -- 2.39.5