From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9923 invoked by alias); 18 May 2005 10:18:18 -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 7113 invoked from network); 18 May 2005 10:16:46 -0000 Received: from unknown (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org with SMTP; 18 May 2005 10:16:46 -0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.0/8.13.0) with ESMTP id j4IAGIum016957; Wed, 18 May 2005 12:16:18 +0200 (CEST) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id j4IAGHhI017415; Wed, 18 May 2005 12:16:17 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id j4IAG9II016351; Wed, 18 May 2005 12:16:09 +0200 (CEST) Date: Wed, 18 May 2005 13:02:00 -0000 Message-Id: <200505181016.j4IAG9II016351@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: woodzltc@cn.ibm.com CC: eliz@gnu.org, gdb-patches@sources.redhat.com In-reply-to: <1116409880.428b10186817f@imap.linux.ibm.com> (message from Wu Zhou on Wed, 18 May 2005 05:51:20 -0400) Subject: Re: two questions about GDB coding standards References: <1116409880.428b10186817f@imap.linux.ibm.com> X-SW-Source: 2005-05/txt/msg00449.txt.bz2 Date: Wed, 18 May 2005 05:51:20 -0400 From: Wu Zhou Quoting Eli Zaretskii : > > Date: Tue, 17 May 2005 11:13:21 -0400 > > From: Wu Zhou > > > > 1. In section 13.4.2(memory management), it is said that gdb uses the > > string function xstrdup and the print function xasprintf. But I saw > > in the source codes that most places use sprintf instead. > > This is just a matter of converting the uses of sprintf into safer > code using xstrdup, xasprintf, xsprintf, etc. Volunteers are welcome. I'd like to contribute. But running splint against GDB source tree, I find over 230 usages of sprintf. If the conversion depends completely on hand work, the workload might be quite big. Is there any method to achieve this more quickly? to say, a script to handle it automatically, or any others? I'm afraid not; but hey you don't have to do all of them ;-). Start with the ones in code that you're a bit familliar with, and see where you end up. Even if you only convert 10% it is very useful. Cheers, Mark