[PATCH] ldso - minor changes, saving some bytes

m m olsajiri at gmail.com
Sun Jan 11 08:57:56 UTC 2009


On Sun, Jan 11, 2009 at 7:34 AM, Rob Landley <rob at landley.net> wrote:
> On Saturday 10 January 2009 11:55:55 olsajiri at gmail.com wrote:
>>       _dl_read(infile, header, _dl_pagesize);
>>       epnt = (ElfW(Ehdr) *) (intptr_t) header;
>> -     if (epnt->e_ident[0] != 0x7f ||
>> -                     epnt->e_ident[1] != 'E' ||
>> -                     epnt->e_ident[2] != 'L' ||
>> -                     epnt->e_ident[3] != 'F')
>> +     if (epnt->e_ident[EI_MAG0] != ELFMAG0 ||
>> +         epnt->e_ident[EI_MAG1] != ELFMAG1 ||
>> +         epnt->e_ident[EI_MAG2] != ELFMAG2 ||
>> +         epnt->e_ident[EI_MAG3] != ELFMAG3)
>
> Why?  The values are never going to change (it would break compatability with
> the entire world), and using the constants you can see what they actually are
> and where they are.
>
> Using macros here only serves to obscure the code to a casual reader.

I understand those values are never going to change, but IMO you should
use macro instead of raw value as a matter of the coding style.

If you dont like macros in this part, then rather dont look what
went finally to the trunk :)

jirka

>
> Rob
>


More information about the uClibc mailing list