From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17349 invoked by alias); 19 Nov 2002 22:09:14 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 17229 invoked from network); 19 Nov 2002 22:09:12 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 19 Nov 2002 22:09:12 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id EEFFD3E39; Tue, 19 Nov 2002 17:09:07 -0500 (EST) Message-ID: <3DDAB683.6010005@redhat.com> Date: Tue, 19 Nov 2002 14:09:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020824 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alan Modra Cc: Klee Dienes , binutils@sources.redhat.com, gdb@sources.redhat.com 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> <20021119214126.GP997@bubble.sa.bigpond.net.au> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-11/txt/msg00234.txt.bz2 > 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. :-( Perhaphs the coding standard applies to just bfd? Assuming it does apply to opcodes/, remember, you've got to start somewhere. One good pace to start is to stop the addition of further stray xmalloc() calls. Andrew