This is the mail archive of the
mailing list for the GDB project.
Re: PATCH: Do not call xmalloc_failed in expandargv
> 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
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