OSDN Git Service

* utils.c (phex_nz): For default case, set str to phex_nz return
authorAndrew Cagney <cagney@redhat.com>
Thu, 15 Nov 2001 18:24:17 +0000 (18:24 +0000)
committerAndrew Cagney <cagney@redhat.com>
Thu, 15 Nov 2001 18:24:17 +0000 (18:24 +0000)
value.

gdb/ChangeLog
gdb/utils.c

index ccb4363..4230841 100644 (file)
@@ -1,5 +1,10 @@
 2001-11-15  Andrew Cagney  <ac131313@redhat.com>
 
+       * utils.c (phex_nz): For default case, set str to phex_nz return
+       value.
+
+2001-11-15  Andrew Cagney  <ac131313@redhat.com>
+
        * TODO (register_buffer): Delete.
        * regcache.c (register_buffer): Make static.
        (regcache_collect): New function.
index e27380a..3775472 100644 (file)
@@ -2442,12 +2442,13 @@ phex (ULONGEST l, int sizeof_l)
 char *
 phex_nz (ULONGEST l, int sizeof_l)
 {
-  char *str = get_cell ();
+  char *str;
   switch (sizeof_l)
     {
     case 8:
       {
        unsigned long high = (unsigned long) (l >> thirty_two);
+       str = get_cell ();
        if (high == 0)
          sprintf (str, "%lx", (unsigned long) (l & 0xffffffff));
        else
@@ -2456,13 +2457,15 @@ phex_nz (ULONGEST l, int sizeof_l)
        break;
       }
     case 4:
+      str = get_cell ();
       sprintf (str, "%lx", (unsigned long) l);
       break;
     case 2:
+      str = get_cell ();
       sprintf (str, "%x", (unsigned short) (l & 0xffff));
       break;
     default:
-      phex_nz (l, sizeof (l));
+      str = phex_nz (l, sizeof (l));
       break;
     }
   return str;