public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: Re: Small code cleanup in dwfl_segment_report_module.c (Was: [commit] [PATCHv2 1/2] Add is_executable to Dwfl_Module.)
Date: Tue, 23 Sep 2014 14:58:58 +0200	[thread overview]
Message-ID: <20140923125858.GA22654@host2.jankratochvil.net> (raw)
In-Reply-To: 1411476613.27706.35.camel@bordewijk.wildebeest.org

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

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

             reply	other threads:[~2014-09-23 12:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 12:58 Jan Kratochvil [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-09-23 15:23 Jan Kratochvil
2014-09-23 15:18 Mark Wielaard
2014-09-23 12:50 Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140923125858.GA22654@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=elfutils-devel@lists.fedorahosted.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).