public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mjw@redhat.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: Re: [PATCH 0/4] Improve elfutils diagnostics
Date: Thu, 14 May 2015 13:16:57 +0200	[thread overview]
Message-ID: <20150514111657.GD26243@blokker.redhat.com> (raw)
In-Reply-To: 20150513173100.GC11588@redhat.com

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

On Wed, May 13, 2015 at 01:31:00PM -0400, Frank Ch. Eigler wrote:
> > One implementation detail that I like to see changed is to make the
> > details errmsg a list of strings instead of one big string (and
> > similarly for dw_tried_paths). [...]
> 
> How would such a list-of-strings be represented?  Considering that
> this is C, and the list arity will vary, we'd be doing dynamic
> allocation anyway, right?

Less allocation is better than more, especially if there are situations
where the extra allocations might not be used anyway.

Note, I am mostly concerned by the asprintf string concats. Those
seem to be done for two reasons that I like to see split out.
They concat because they want to represent the errno (string) and
an extra argument (e.g. file not found plus file name). In which case
I think it is better to store that as two separate items, the errno
and the detail, so no extra string needs to be constructed, unless
the user want to. And to add compound failures together. In that case
I think an array or list of failures (errno plus detail pairs) would
be better.

So the ideal way to represent it might be an array plus length of
pairs typedef struct Dwfl_ErrDetail { int errno, const char *detail }.
Then the array can be preallocated and realloced when necessary.

Cheers,

Mark

             reply	other threads:[~2015-05-14 11:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 11:16 Mark Wielaard [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-05-15 21:21 Mark Wielaard
2015-05-15 16:10 Frank Ch. Eigler
2015-05-14 11:46 Mark Wielaard
2015-05-13 18:44 Jonathan Lebon
2015-05-13 17:31 Frank Ch. Eigler
2015-05-13 16:28 Mark Wielaard
2015-05-11 19:38 Jonathan Lebon

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=20150514111657.GD26243@blokker.redhat.com \
    --to=mjw@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).