This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [commit] Use xsnprint for xxx_pid_to_str()


   Date: Tue, 19 Jul 2005 20:57:22 +0800 (CST)
   From: Wu Zhou <woodzltc@cn.ibm.com>

   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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]