[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Trying to understand some code in ReadElf
From: |
Arnon Meidav |
Subject: |
RE: Trying to understand some code in ReadElf |
Date: |
Thu, 14 Mar 2002 10:22:16 +0200 |
OOPS.... I understand it now. I am sorry I wasted your time.
I now realize that you use first_attr to begin walking through the list, and
it links until it reaches last_attr.
My humble apologies,
- Arnon
> -----Original Message-----
> From: Arnon Meidav
> Sent: Thursday, March 14, 2002 10:15 AM
> To: 'address@hidden'
> Subject: Trying to understand some code in ReadElf
>
> 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
>