This is the mail archive of the rda@sourceware.org mailing list for the rda project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Minor lib/gdbserv-output optimization


While comparing Red Hat's internal RDA sources to the public ones, I came
across this old change by Michael Snyder.

Committed.

Kevin

2009-11-06  Kevin Buettner  <kevinb@redhat.com>

	From Michael Snyder (circa 2004):
	* lib/gdbserv-output.c (gdbserv_output_string_as_bytes): 
	Pull strlen out of loop for optimization.
	(gdbserv_output_string): Ditto.
	
Index: lib/gdbserv-output.c
===================================================================
RCS file: /cvs/src/src/rda/lib/gdbserv-output.c,v
retrieving revision 1.2
diff -u -p -r1.2 gdbserv-output.c
--- lib/gdbserv-output.c	24 Sep 2004 21:18:59 -0000	1.2
+++ lib/gdbserv-output.c	7 Nov 2009 05:19:35 -0000
@@ -57,7 +57,9 @@ void
 gdbserv_output_string_as_bytes (struct gdbserv *gdbserv, const char *packet)
 {
   int i;
-  for (i = 0; i < strlen (packet); i++)
+  int len = strlen (packet);
+
+  for (i = 0; i < len; i++)
     {
       gdbserv_output_byte (gdbserv, packet[i]);
     }
@@ -67,7 +69,9 @@ void
 gdbserv_output_string (struct gdbserv *gdbserv, const char *packet)
 {
   int i;
-  for (i = 0; i < strlen (packet); i++)
+  int len = strlen (packet);
+
+  for (i = 0; i < len; i++)
     gdbserv_output_char (gdbserv, packet[i]);
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]