gdbscm_memory_port_write: use local variable to avoid adding casts
authorSimon Marchi <simon.marchi@polymtl.ca>
Mon, 26 Oct 2015 12:41:37 +0000 (08:41 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Mon, 26 Oct 2015 12:41:37 +0000 (08:41 -0400)
By having a local variable of type (const gdb_byte *), we can avoid adding
two casts.

gdb/ChangeLog:

* guile/scm-ports.c (gdbscm_memory_port_write): Declare new
"data" local variable and use it.

gdb/ChangeLog
gdb/guile/scm-ports.c

index ecc286f5e0857f5b87663217ba11ee61b3ac0b09..2fc342756589bf13d3ff25e86f3a7c9437e4bf94 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-26  Simon Marchi  <simon.marchi@polymtl.ca>
+
+       * guile/scm-ports.c (gdbscm_memory_port_write): Declare new
+       "data" local variable and use it.
+
 2015-10-26  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * guile/scm-symbol.c (gdbscm_lookup_global_symbol): Add
index 90bdb395f7fe3ab3fc6552e39d603c5168cbec54..10d7ee2659edc15ea9643f1412806dfd04433db9 100644 (file)
@@ -716,10 +716,11 @@ gdbscm_memory_port_flush (SCM port)
 /* "write" method for memory ports.  */
 
 static void
-gdbscm_memory_port_write (SCM port, const void *data, size_t size)
+gdbscm_memory_port_write (SCM port, const void *void_data, size_t size)
 {
   scm_t_port *pt = SCM_PTAB_ENTRY (port);
   ioscm_memory_port *iomem = (ioscm_memory_port *) SCM_STREAM (port);
+  const gdb_byte *data = (const gdb_byte *) void_data;
 
   /* There's no way to indicate a short write, so if the request goes past
      the end of the port's memory range, flag an error.  */
@@ -758,7 +759,7 @@ gdbscm_memory_port_write (SCM port, const void *data, size_t size)
        pt->write_pos = pt->write_end;
        gdbscm_memory_port_flush (port);
        {
-         const void *ptr = ((const char *) data) + space;
+         const gdb_byte *ptr = data + space;
          size_t remaining = size - space;
 
          if (remaining >= pt->write_buf_size)