This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Replace strdup with xstrdup in tic30-dis.c
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Andrew Cagney <ac131313 at redhat dot com>
- Cc: Klee Dienes <klee at apple dot com>, binutils at sources dot redhat dot com, gdb at sources dot redhat dot com
- Date: Wed, 20 Nov 2002 08:11:26 +1030
- Subject: Re: [RFA] Replace strdup with xstrdup in tic30-dis.c
- References: <555D137A-FB43-11D6-84AF-00039396EEB8@apple.com> <20021119071305.GM997@bubble.sa.bigpond.net.au> <3DDA6624.5000500@redhat.com>
On Tue, Nov 19, 2002 at 11:26:12AM -0500, Andrew Cagney wrote:
> I know BFD intentionally doesn't use the x*() functions. Instead it
> tries to clean up and return an error indication when there is a
> malloc() failure.
>
> What of the disassembler though? GDB, which is depending on the
> disassembler, needs to be able to recover from low memory (aka malloc()
> failure) conditions.
I OK'd the patch too quickly, then remembered the no xmalloc rule..
Then on grepping through opcodes/*, I saw so many xmalloc and xstrdup
calls that I hardly felt like correcting the patch. We're no worse
off with an xstrdup call than an unchecked strdup call. :-(
--
Alan Modra
IBM OzLabs - Linux Technology Centre