This is the mail archive of the gdb-patches@sourceware.org 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]

[commit] Further simplify gdbserver/utils.c/decimal2str



I forgot to initialize "width" to zero before, but it turns out to be set to nine anyway. Sorry about the magic number, but it was already
there... ;-/



2011-02-28  Michael Snyder  <msnyder@vmware.com>

	* utils.c (decimal2str): Initialize 'width' to nine, then
	don't mess with it.

Index: gdbserver/utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/utils.c,v
retrieving revision 1.30
diff -u -p -u -p -r1.30 utils.c
--- gdbserver/utils.c	26 Feb 2011 18:53:44 -0000	1.30
+++ gdbserver/utils.c	28 Feb 2011 21:58:37 -0000
@@ -263,19 +263,16 @@ decimal2str (char *sign, ULONGEST addr)
   unsigned long temp[3];
   char *str = get_cell ();
   int i = 0;
-  int width;
+  int width = 9;
 
   do
     {
       temp[i] = addr % (1000 * 1000 * 1000);
       addr /= (1000 * 1000 * 1000);
       i++;
-      width -= 9;
     }
   while (addr != 0 && i < (sizeof (temp) / sizeof (temp[0])));
 
-  width = 9;
-
   switch (i)
     {
     case 1:

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