Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] remove unnecessary alloca/memcpy in write_memory
@ 2008-08-06  4:48 Doug Evans
  2008-08-06 11:26 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2008-08-06  4:48 UTC (permalink / raw)
  To: gdb-patches

Hi.  Any ideas why the call to alloca/memcpy?
[Why not pass myaddr to target_write_memory directly?]

void
write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
{
  int status;
  gdb_byte *bytes = alloca (len);
  
  memcpy (bytes, myaddr, len);
  status = target_write_memory (memaddr, bytes, len);
  if (status != 0)
    memory_error (status, memaddr);
}

2008-08-05  Doug Evans  <dje@google.com>

	* corefile.c (write_memory): Remove unnecessary copying.

Index: corefile.c
===================================================================
RCS file: /cvs/src/src/gdb/corefile.c,v
retrieving revision 1.44
diff -u -p -u -p -r1.44 corefile.c
--- corefile.c	30 Apr 2008 18:22:37 -0000	1.44
+++ corefile.c	6 Aug 2008 04:45:25 -0000
@@ -350,10 +350,7 @@ void
 write_memory (CORE_ADDR memaddr, const bfd_byte *myaddr, int len)
 {
   int status;
-  gdb_byte *bytes = alloca (len);
-  
-  memcpy (bytes, myaddr, len);
-  status = target_write_memory (memaddr, bytes, len);
+  status = target_write_memory (memaddr, myaddr, len);
   if (status != 0)
     memory_error (status, memaddr);
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-06 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-06  4:48 [RFA] remove unnecessary alloca/memcpy in write_memory Doug Evans
2008-08-06 11:26 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox