summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-01-18 23:08:30 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2018-01-19 09:38:28 +0100
commit7bc35e2f318d53303d6055b58de5afe6003454b6 (patch)
treecdfb836002e3ca83053e38e9fb38b90ea7cbcba0
parenteba4e21990e5aa0b9e4aee4751f4756356a4f95a (diff)
downloadvala-7bc35e2f318d53303d6055b58de5afe6003454b6.tar.gz
codewriter: Don't use string.replace() to apply header_to_override
The underlying regex causes faulty replacements. https://bugzilla.gnome.org/show_bug.cgi?id=731322
-rw-r--r--vala/valacodewriter.vala8
1 files changed, 7 insertions, 1 deletions
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index ec48ed03d..7318c35a6 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -212,7 +212,13 @@ public class Vala.CodeWriter : CodeVisitor {
}
if (header_to_override != null) {
- cheaders = cheaders.replace (header_to_override, override_header).replace (",,", ",");
+ var cheaders_array = cheaders.split (",");
+ for (int i = 0; i < cheaders_array.length; i++) {
+ if (cheaders_array[i] == header_to_override) {
+ cheaders_array[i] = override_header;
+ }
+ }
+ cheaders = string.joinv (",", cheaders_array);
}
}
return cheaders;