Kaydet (Commit) 0eadc9bd authored tarafından Colomban Wendling's avatar Colomban Wendling

Compute needle length only once in utils_string_replace_all()

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5966 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst a89fcc2c
......@@ -1581,6 +1581,7 @@ guint utils_string_replace_all(GString *haystack, const gchar *needle, const gch
{
guint count = 0;
gint pos = 0;
gsize needle_length = strlen(needle);
while (1)
{
......@@ -1589,7 +1590,7 @@ guint utils_string_replace_all(GString *haystack, const gchar *needle, const gch
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment