[vala/0.36] codewriter: Don't use string.replace() to apply header_to_override
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.36] codewriter: Don't use string.replace() to apply header_to_override
- Date: Fri, 19 Jan 2018 08:39:37 +0000 (UTC)
commit 2b49af3421bd794fff1513990676b8bfe91045c6
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Jan 18 23:08:30 2018 +0100
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
vala/valacodewriter.vala | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index 8c0e688..2fed2d8 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -214,7 +214,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]