SF.net SVN: geany:[5966] trunk/src/utils.c

colombanw at users.sourceforge.net colombanw at xxxxx
Wed Sep 28 19:49:45 UTC 2011


Revision: 5966
          http://geany.svn.sourceforge.net/geany/?rev=5966&view=rev
Author:   colombanw
Date:     2011-09-28 19:49:45 +0000 (Wed, 28 Sep 2011)
Log Message:
-----------
Compute needle length only once in utils_string_replace_all()

Modified Paths:
--------------
    trunk/src/utils.c

Modified: trunk/src/utils.c
===================================================================
--- trunk/src/utils.c	2011-09-28 19:49:28 UTC (rev 5965)
+++ trunk/src/utils.c	2011-09-28 19:49:45 UTC (rev 5966)
@@ -1581,6 +1581,7 @@
 {
 	guint count = 0;
 	gint pos = 0;
+	gsize needle_length = strlen(needle);
 
 	while (1)
 	{
@@ -1589,7 +1590,7 @@
 		if (pos == -1)
 			break;
 
-		pos = utils_string_replace(haystack, pos, strlen(needle), replace);
+		pos = utils_string_replace(haystack, pos, needle_length, replace);
 		count++;
 	}
 	return count;

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list