From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28896 invoked by alias); 14 Feb 2002 15:59:35 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 28768 invoked from network); 14 Feb 2002 15:59:31 -0000 Received: from unknown (HELO lacrosse.corp.redhat.com) (12.107.208.154) by sources.redhat.com with SMTP; 14 Feb 2002 15:59:31 -0000 Received: from cgf.cipe.redhat.com (dhcpd80.meridian.redhat.com [172.16.47.80]) by lacrosse.corp.redhat.com (8.11.6/8.9.3) with ESMTP id g1EFxTd27731 for ; Thu, 14 Feb 2002 10:59:29 -0500 Received: (from cgf@localhost) by cgf.cipe.redhat.com (8.11.6/8.8.7) id g1EFxaO29484 for gdb-patches@sources.redhat.com; Thu, 14 Feb 2002 10:59:36 -0500 Date: Thu, 14 Feb 2002 07:59:00 -0000 From: Christopher Faylor To: gdb-patches@sources.redhat.com Subject: Re: [RFA] win32-nat printf and sprintf removal Message-ID: <20020214155936.GL23253@redhat.com> Mail-Followup-To: gdb-patches@sources.redhat.com References: <4.2.0.58.20020208182442.00ad05e0@ics.u-strasbg.fr> <4.2.0.58.20020208182442.00ad05e0@ics.u-strasbg.fr> <4.2.0.58.20020214121240.01a80208@ics.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4.2.0.58.20020214121240.01a80208@ics.u-strasbg.fr> User-Agent: Mutt/1.3.23.1i X-SW-Source: 2002-02/txt/msg00408.txt.bz2 On Thu, Feb 14, 2002 at 12:17:17PM +0100, Pierre Muller wrote: > >@@ -1763,9 +1763,9 @@ cygwin_pid_to_str (ptid_t ptid) >> > int pid = PIDGET (ptid); >> > >> > if ((DWORD) pid == current_event.dwProcessId) >> >- sprintf (buf, "process %d", pid); >> >+ xaprintf (buf, "process %d", pid); >> > else >> >- sprintf (buf, "thread %ld.0x%x", current_event.dwProcessId, pid); >> >+ xasprintf (buf, "thread %ld.0x%x", current_event.dwProcessId, pid); >> > return buf; > >As this is a static buffer, xasprintf can't be used here.... >Andrew, why are the target_pid_to_str functions supposed to return static buffers? >Isn't that a big waste of memory? No. >> >@@ -2009,7 +2009,7 @@ _initialize_check_for_gdb_ini (void) >> > { >> > int len = strlen (oldini); >> > char *newini = alloca (len + 1); >> >- sprintf (newini, "%.*s.gdbinit", >> >+ xasprintf (newini, "%.*s.gdbinit", >> > (int) (len - (sizeof ("gdb.ini") - 1)), oldini); >> > warning ("obsolete '%s' found. Rename to '%s'.", oldini, newini); >> > } > > I corrected this one to this patch, >which doesn't give any warning. >But the memory allocated for oldini is still lost.... >Can I check this in? No. Please don't mess with the sprintfs in win32-nat.c. cgf