Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] gdbserver/server.c: Replace 2x strlen() by a variable
@ 2006-12-21  7:45 Markus Deuling
  2006-12-21 11:08 ` Joel Brobecker
  0 siblings, 1 reply; 6+ messages in thread
From: Markus Deuling @ 2006-12-21  7:45 UTC (permalink / raw)
  To: GDB Patches

Hello,

this little patch adds a variable to prevent strlen() from being called two times.
Maybe it would also be a good idea to replace it by the hard-coded length, but I think
the code then will be less readable then.

Is it ok to apply ?

ChangeLog:

	* server.c (handle_general_set): New variable len instead
	of using strlen two times.

=========================================
diff -urN src/gdb/gdbserver/server.c dev/gdb/gdbserver/server.c
--- src/gdb/gdbserver/server.c	2006-12-21 08:38:11.000000000 +0100
+++ dev/gdb/gdbserver/server.c	2006-12-21 08:38:25.000000000 +0100
@@ -163,10 +163,11 @@
 void
 handle_general_set (char *own_buf)
 {
-  if (strncmp ("QPassSignals:", own_buf, strlen ("QPassSignals:")) == 0)
+  int len = strlen ("QPassSignals:");
+  if (strncmp ("QPassSignals:", own_buf, len) == 0)
     {
       int numsigs = (int) TARGET_SIGNAL_LAST, i;
-      const char *p = own_buf + strlen ("QPassSignals:");
+      const char *p = own_buf + len;
       CORE_ADDR cursig;
 
       p = decode_address_to_semicolon (&cursig, p);

Regards,
Markus

-- 
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com 


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

end of thread, other threads:[~2006-12-26 15:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-21  7:45 [RFA] gdbserver/server.c: Replace 2x strlen() by a variable Markus Deuling
2006-12-21 11:08 ` Joel Brobecker
2006-12-21 11:48   ` Andreas Schwab
2006-12-21 12:47   ` Mark Kettenis
2006-12-21 13:04     ` Joel Brobecker
2006-12-26 15:35       ` Daniel Jacobowitz

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