This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils 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: Small code cleanup in dwfl_segment_report_module.c (Was: [commit] [PATCHv2 1/2] Add is_executable to Dwfl_Module.)


On Tue, 23 Sep 2014 14:50:13 +0200, Mark Wielaard wrote:
> Updated cleanup based on current master attached.

FYI I find that patch rather hiding what the code really does, in summary it
has done:

-    if (ehdr.e32.e_ident[EI_DATA] == MY_ELFDATA)
+  ei_data = ((const unsigned char *) buffer)[EI_DATA];
+    if (ei_data == MY_ELFDATA)

-  if (ehdr.e32.e_ident[EI_CLASS] == ELFCLASS32)
+  ei_class = ((const unsigned char *) buffer)[EI_CLASS];
+  if (ei_class == ELFCLASS32)

By jumping on the 'e_ident' tag one could say what is being referenced.
But now 'buffer' is 'void *' and it is being cast to 'const unsigned char *'.
And neither 'EI_DATA' nor 'EI_CLASS' reference 'e_ident' in their comment.

Not that it matters much but when there has been already some effort put into
it.


Jan

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