replace unhexify with hex2bin
authorTom Tromey <tromey@redhat.com>
Sun, 19 Jan 2014 02:41:08 +0000 (19:41 -0700)
committerTom Tromey <tromey@redhat.com>
Wed, 12 Feb 2014 16:59:19 +0000 (09:59 -0700)
unhexify and hex2bin are identical, so this removes unhexify.  The
particular choice of which to keep was made on the basis of
parallelism with the earlier patch that removed hexify.

2014-02-12  Tom Tromey  <tromey@redhat.com>

* common/rsp-low.h (unhexify): Don't declare.
* common/rsp-low.c (unhexify): Remove.

2014-02-12  Tom Tromey  <tromey@redhat.com>

* server.c (handle_query, handle_v_run): Use hex2bin, not
unhexify.
* tracepoint.c (cmd_qtdpsrc, cmd_qtdv, cmd_qtnotes): Likewise.

gdb/ChangeLog
gdb/common/rsp-low.c
gdb/common/rsp-low.h
gdb/gdbserver/ChangeLog
gdb/gdbserver/server.c
gdb/gdbserver/tracepoint.c

index 85b420a00d378a0f38fdd2b74824279ef25b744a..82e09aa19d0155b6216b1fed89af0156467a473c 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-12  Tom Tromey  <tromey@redhat.com>
+
+       * common/rsp-low.h (unhexify): Don't declare.
+       * common/rsp-low.c (unhexify): Remove.
+
 2014-02-12  Tom Tromey  <tromey@redhat.com>
 
        * common/rsp-low.h (convert_int_to_ascii): Don't declare.
index c7a00c1308b4c08d56f5d2fc873af8c9f24383b6..decd23c846b946eca5bafc888db5a12fc77c657f 100644 (file)
@@ -127,25 +127,6 @@ hex2bin (const char *hex, gdb_byte *bin, int count)
   return i;
 }
 
-int
-unhexify (char *bin, const char *hex, int count)
-{
-  int i;
-
-  for (i = 0; i < count; i++)
-    {
-      if (hex[0] == 0 || hex[1] == 0)
-       {
-         /* Hex string is short, or of uneven length.
-            Return the count that has been converted so far. */
-         return i;
-       }
-      *bin++ = fromhex (hex[0]) * 16 + fromhex (hex[1]);
-      hex += 2;
-    }
-  return i;
-}
-
 void
 convert_ascii_to_int (const char *from, unsigned char *to, int n)
 {
index e1944cf92a8f6b75621a529a99c7c2538752df55..b793f1533e53c6a59ff1f343c9106b811364b4fb 100644 (file)
@@ -36,8 +36,6 @@ extern char *unpack_varlen_hex (char *buff, ULONGEST *result);
 
 extern int hex2bin (const char *hex, gdb_byte *bin, int count);
 
-extern int unhexify (char *bin, const char *hex, int count);
-
 extern void convert_ascii_to_int (const char *from, unsigned char *to, int n);
 
 extern int bin2hex (const gdb_byte *bin, char *hex, int count);
index cacc74beee5c2c41ca2e93baa87988472120696f..f0d092dfd5f6c9a5c121b504d0a484c4364f87f8 100644 (file)
@@ -1,3 +1,9 @@
+2014-02-12  Tom Tromey  <tromey@redhat.com>
+
+       * server.c (handle_query, handle_v_run): Use hex2bin, not
+       unhexify.
+       * tracepoint.c (cmd_qtdpsrc, cmd_qtdv, cmd_qtnotes): Likewise.
+
 2014-02-12  Tom Tromey  <tromey@redhat.com>
 
        * ax.c (gdb_unparse_agent_expr): Use bin2hex, not
index e582598ecaeb2cfc4e80042aeeee81a2446037a2..1ea1bde9f9a8b988106eb17d80181a68a8ee5c35 100644 (file)
@@ -2025,7 +2025,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
          return;
        }
 
-      if ((len % 2) != 0 || unhexify (mon, own_buf + 6, len / 2) != len / 2)
+      if ((len % 2) != 0
+         || hex2bin (own_buf + 6, (gdb_byte *) mon, len / 2) != len / 2)
        {
          write_enn (own_buf);
          free (mon);
@@ -2408,7 +2409,7 @@ handle_v_run (char *own_buf)
        {
          /* FIXME: Fail request if out of memory instead of dying.  */
          new_argv[i] = xmalloc (1 + (next_p - p) / 2);
-         unhexify (new_argv[i], p, (next_p - p) / 2);
+         hex2bin (p, (gdb_byte *) new_argv[i], (next_p - p) / 2);
          new_argv[i][(next_p - p) / 2] = '\0';
        }
 
index df320059be379bbb0472fac3200bd0f17c5a5aa9..8e294f64c0b8a7a6307070e431612806f40e984c 100644 (file)
@@ -2708,7 +2708,7 @@ cmd_qtdpsrc (char *own_buf)
   packet = unpack_varlen_hex (packet, &slen);
   ++packet; /* skip a colon */
   src = xmalloc (slen + 1);
-  nbytes = unhexify (src, packet, strlen (packet) / 2);
+  nbytes = hex2bin (packet, (gdb_byte *) src, strlen (packet) / 2);
   src[nbytes] = '\0';
 
   newlast = xmalloc (sizeof (struct source_string));
@@ -2750,7 +2750,7 @@ cmd_qtdv (char *own_buf)
 
   nbytes = strlen (packet) / 2;
   varname = xmalloc (nbytes + 1);
-  nbytes = unhexify (varname, packet, nbytes);
+  nbytes = hex2bin (packet, (gdb_byte *) varname, nbytes);
   varname[nbytes] = '\0';
 
   tsv = create_trace_state_variable (num, 1);
@@ -4108,7 +4108,7 @@ cmd_qtnotes (char *own_buf)
          packet = strchr (packet, ';');
          nbytes = (packet - saved) / 2;
          user = xmalloc (nbytes + 1);
-         nbytes = unhexify (user, saved, nbytes);
+         nbytes = hex2bin (saved, (gdb_byte *) user, nbytes);
          user[nbytes] = '\0';
          ++packet; /* skip the semicolon */
          trace_debug ("User is '%s'", user);
@@ -4122,7 +4122,7 @@ cmd_qtnotes (char *own_buf)
          packet = strchr (packet, ';');
          nbytes = (packet - saved) / 2;
          notes = xmalloc (nbytes + 1);
-         nbytes = unhexify (notes, saved, nbytes);
+         nbytes = hex2bin (saved, (gdb_byte *) notes, nbytes);
          notes[nbytes] = '\0';
          ++packet; /* skip the semicolon */
          trace_debug ("Notes is '%s'", notes);
@@ -4136,7 +4136,7 @@ cmd_qtnotes (char *own_buf)
          packet = strchr (packet, ';');
          nbytes = (packet - saved) / 2;
          stopnote = xmalloc (nbytes + 1);
-         nbytes = unhexify (stopnote, saved, nbytes);
+         nbytes = hex2bin (saved, (gdb_byte *) stopnote, nbytes);
          stopnote[nbytes] = '\0';
          ++packet; /* skip the semicolon */
          trace_debug ("tstop note is '%s'", stopnote);
This page took 0.038914 seconds and 4 git commands to generate.