public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: DJ Delorie <dj@redhat.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 15:46:00 -0000	[thread overview]
Message-ID: <43396939.4030602@codesourcery.com> (raw)
In-Reply-To: <200509271540.j8RFeBbf016490@greed.delorie.com>

DJ Delorie wrote:

> I seem to recall a general policy (before my time) that libiberty
> functions shouldn't ever exit on error; the proper response is to
> return some error condition to the application.  Since expandargv()
> doesn't have an error response, IMHO the right thing to do is treat
> @foo as if it weren't a file and just return the original argv[n].
> The application will hopefully discover the out of memory condition
> itself and use its own handlers to deal with it.

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 can make the change that you suggest, if you think it's important, but
it seems more friendly to the user to just tell them early that there
was a problem; the application won't know if "@foo" remains in the
argument list because there was no such file "foo" or because it
happened to be too big.  In the latter case, the program should exit; in
the former, we've agreed that "@foo" should be treated as a literal
command-line argument.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

  reply	other threads:[~2005-09-27 15:46 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 [this message]
2005-09-27 18:04     ` DJ Delorie
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=43396939.4030602@codesourcery.com \
    --to=mark@codesourcery.com \
    --cc=dj@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=ian@airs.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).