Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: mark@codesourcery.com
Cc: gdb@sources.redhat.com, gdb-patches@sources.redhat.com, ian@airs.com
Subject: Re: PATCH: Do not call xmalloc_failed in expandargv
Date: Tue, 27 Sep 2005 18:04:00 -0000	[thread overview]
Message-ID: <200509271623.j8RGNDDA017974@greed.delorie.com> (raw)
In-Reply-To: <43396939.4030602@codesourcery.com> (message from Mark Mitchell on Tue, 27 Sep 2005 08:46:01 -0700)


> xmalloc is in libiberty, and it calls xmalloc_failed when it fails,
> which itself calls xexit.  That's the source of the idiom; I was
> just trying to be consistent.

I don't feel strongly about it.  I bring it up only to cover all
possibilities.  I guess if you run out of memory in the first
allocation after main starts, you're screwed anyway.  Er... don't
expect fputs() to work if you're out of memory at that point; it won't
be able to allocate stdio buffers.  write(2,...) would be safer, if
less portable.

Hmmm... dupargv calls malloc(), not xmalloc().  expandargv calls
xmalloc(), but that's the only call to xmalloc in that file.  I wonder
if we're looking at the wrong idiom for this file?

I also know that bfd itself has a rule that errors can't call exit;
they must return error codes to the caller.  This doesn't affect
expandargv because bfd itself has no applications, but it's food for
thought.


  reply	other threads:[~2005-09-27 18:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-27 14:51 Mark Mitchell
2005-09-27 15:17 ` Ian Lance Taylor
2005-09-27 15:22   ` Mark Mitchell
2005-09-27 15:40 ` DJ Delorie
2005-09-27 15:46   ` Mark Mitchell
2005-09-27 18:04     ` DJ Delorie [this message]
2005-09-27 18:33       ` Mark Mitchell
2005-09-27 18:35         ` DJ Delorie

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=200509271623.j8RGNDDA017974@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=ian@airs.com \
    --cc=mark@codesourcery.com \
    /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