Mercurial > gnulib
changeset 40122:33ac33ab575c
relocatable: avoid compiler warnings (-Wshadow)
* lib/relocatable.c (compute_curr_prefix): Rename local variables
to avoid name collisions with global variables.
author | Akim Demaille <akim.demaille@gmail.com> |
---|---|
date | Thu, 24 Jan 2019 01:54:22 +0100 |
parents | 6240a6971ae1 |
children | 3d62cdd3f081 |
files | ChangeLog lib/relocatable.c |
diffstat | 2 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jan 23 01:17:07 2019 +0100 +++ b/ChangeLog Thu Jan 24 01:54:22 2019 +0100 @@ -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.
--- a/lib/relocatable.c Wed Jan 23 01:17:07 2019 +0100 +++ b/lib/relocatable.c Thu Jan 24 01:54:22 2019 +0100 @@ -268,7 +268,7 @@ } 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 @@ } { - 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; } } }