This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: PATCH: Do not call xmalloc_failed in expandargv
- From: DJ Delorie <dj at redhat dot com>
- To: mark at codesourcery dot com
- Cc: gdb at sources dot redhat dot com, gdb-patches at sources dot redhat dot com, ian at airs dot com
- Date: Tue, 27 Sep 2005 11:40:11 -0400
- Subject: Re: PATCH: Do not call xmalloc_failed in expandargv
- References: <200509271451.j8REpKeg029702@sethra.codesourcery.com>
> if (!*argvp)
> ! {
> ! fprintf (stderr, "\n%sout of memory\n");
> ! xexit (1);
> ! }
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.