Fix incorrect result for replace_all (bug 5064, r=dvander).

Former-commit-id: e3824c4c87
This commit is contained in:
Fysiks 2013-02-13 00:40:57 -08:00
parent 5e69db511c
commit a26a98cb98

View File

@ -238,6 +238,8 @@ stock replace_all(string[], len, const what[], const with[])
while (replace(string[pos], len - pos, what, with) != 0) while (replace(string[pos], len - pos, what, with) != 0)
{ {
total++;
/* jump to position after replacement */ /* jump to position after replacement */
pos += with_len; pos += with_len;
@ -261,7 +263,6 @@ stock replace_all(string[], len, const what[], const with[])
/* otherwise, reposition and update counters */ /* otherwise, reposition and update counters */
pos += temp_pos; pos += temp_pos;
total++;
} }
return total; return total;