This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: two questions about GDB coding standards
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: woodzltc at cn dot ibm dot com
- Cc: eliz at gnu dot org, gdb-patches at sources dot redhat dot com
- Date: Wed, 18 May 2005 12:16:09 +0200 (CEST)
- Subject: Re: two questions about GDB coding standards
- References: <1116409880.428b10186817f@imap.linux.ibm.com>
Date: Wed, 18 May 2005 05:51:20 -0400
From: Wu Zhou <woodzltc@cn.ibm.com>
Quoting Eli Zaretskii <eliz@gnu.org>:
> > Date: Tue, 17 May 2005 11:13:21 -0400
> > From: Wu Zhou <woodzltc@cn.ibm.com>
> >
> > 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