On Sunday 11 January 2009 09:57, m m wrote: > On Sun, Jan 11, 2009 at 7:34 AM, Rob Landley <[email protected]> wrote: > > On Saturday 10 January 2009 11:55:55 [email protected] 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
What went on the trunk compares all four bytes in one go, as uint32_t constant. I'd happily compare them to literal "\177ELF" but C does not allow me to construct integer literals like this. That's why there is a #define now. -- vda _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
