From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9273 invoked by alias); 19 Jul 2005 17:20:23 -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 9184 invoked by uid 22791); 19 Jul 2005 17:20:16 -0000 Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 19 Jul 2005 17:20:16 +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 j6JHK1RT023072; Tue, 19 Jul 2005 19:20:01 +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 j6JHK07K026032; Tue, 19 Jul 2005 19:20:00 +0200 (CEST) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id j6JHJuHi007535; Tue, 19 Jul 2005 19:19:56 +0200 (CEST) Date: Tue, 19 Jul 2005 17:20:00 -0000 Message-Id: <200507191719.j6JHJuHi007535@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: woodzltc@cn.ibm.com CC: gdb-patches@sourceware.org In-reply-to: (message from Wu Zhou on Tue, 19 Jul 2005 20:57:22 +0800 (CST)) Subject: Re: [commit] Use xsnprint for xxx_pid_to_str() References: <200507182101.j6IL1CjP015639@elgar.sibelius.xs4all.nl> X-SW-Source: 2005-07/txt/msg00161.txt.bz2 Date: Tue, 19 Jul 2005 20:57:22 +0800 (CST) From: Wu Zhou On Mon, 18 Jul 2005, Mark Kettenis wrote: > Small simplification now that we have xsnprintf. Please do something > similar to your favourite code if it doesn't use this idiom yet. Mark, Here is a similar patch to remote_pid_to_str in remote.c: Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.194 diff -c -p -r1.194 remote.c *** remote.c 22 Jun 2005 11:42:54 -0000 1.194 --- remote.c 19 Jul 2005 12:53:37 -0000 *************** static char * *** 5316,5325 **** remote_pid_to_str (ptid_t ptid) { static char buf[32]; - int size; ! size = snprintf (buf, sizeof buf, "thread %d", ptid_get_pid (ptid)); ! gdb_assert (size < sizeof buf); return buf; } --- 5316,5323 ---- remote_pid_to_str (ptid_t ptid) { static char buf[32]; ! xsnprintf (buf, sizeof buf, "thread %d", ptid_get_pid (ptid)); return buf; } OK to commit? Thanks. With a proper ChangeLog entry, yes! Thanks, Mark