This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] elf/dl-lookup.c: Remove unused variable


On Tue, Jun 28, 2011 at 05:43:40PM +0200, Marek Polacek wrote:
> As reported by GCC's -Wunused-but-set-variable, the variable `nchain'
> is not used, thus not needed.
> 
> 2011-06-28  Marek Polacek  <mpolacek@redhat.com>
> 
> 	* elf/dl-lookup.c (_dl_setup_hash): Remove unused variable.
> 
> --- libc/elf/dl-lookup.c.mp     2011-06-28 17:21:09.409592032 +0200
> +++ libc/elf/dl-lookup.c        2011-06-28 17:21:20.160480113 +0200
> @@ -860,7 +860,6 @@ internal_function
>  _dl_setup_hash (struct link_map *map)
>  {
>    Elf_Symndx *hash;
> -  Elf_Symndx nchain;
>  
>    if (__builtin_expect (map->l_info[DT_ADDRTAGIDX (DT_GNU_HASH) + DT_NUM
>                                     + DT_THISPROCNUM + DT_VERSIONTAGNUM
> @@ -892,7 +891,6 @@ _dl_setup_hash (struct link_map *map)
>    hash = (void *) D_PTR (map, l_info[DT_HASH]);
>  
>    map->l_nbuckets = *hash++;
> -  nchain = *hash++;
>    map->l_buckets = hash;

This looks wrong, it changes the behavior.  If nchain isnt used here,
you can remove that line, but need to use then
  map->l_nbuckets = *hash++;
  map->l_buckets = ++hash;
or
  map->l_nbuckets = *hash;
  hash += 2;
  map->l_buckets = hash;

>    hash += map->l_nbuckets;
>    map->l_chain = hash;

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]