bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to understand some code in ReadElf


From: Arnon Meidav
Subject: Trying to understand some code in ReadElf
Date: Thu, 14 Mar 2002 10:15:27 +0200

Hi,
I am not sure if this is a bug, or just a misunderstanding of the code on my
part.

I am looking at the function:
add_abbrev_attr (attribute, form)
in readelf.c,   version: GNU readelf 2.11.92 20011001

The relevant lines of the function are:
{   ...
  if (last_abbrev->first_attr == NULL)
    last_abbrev->first_attr = attr;
  else
    last_abbrev->last_attr->next = attr;

  last_abbrev->last_attr = attr;
}

It looks to me like the old "last_abbrev->last_attr" is lost as a result of
the last line. attr is saved twice: first in last_abbrev->last_attr->next,
and then in last_abbrev->last_attr, but there is no pointer to the previous
value of last_abbrev->last_attr (and therefore the previous command, setting
last_abbrev->last_attr->next seems redundant, or at least the effect of this
action seems to be lost).

Am I missing something here?
Thanks for your help,
 - Arnon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]