[vala/staging: 1/10] glib-2.0: Add simple fast-path to string.replace()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging: 1/10] glib-2.0: Add simple fast-path to string.replace()
- Date: Thu, 3 Nov 2016 19:48:59 +0000 (UTC)
commit c644e6ca428c36402dbe3c5d1c27788acfe5b3cb
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Nov 3 19:31:28 2016 +0100
glib-2.0: Add simple fast-path to string.replace()
vapi/glib-2.0.vapi | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index dc9ffbe..06cd9d7 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1397,6 +1397,9 @@ public class string {
}
public string replace (string old, string replacement) {
+ if (*((char*) this) == '\0' || *((char*) old) == '\0' || old == replacement)
+ return this;
+
try {
var regex = new GLib.Regex (GLib.Regex.escape_string (old));
return regex.replace_literal (this, -1, 0, replacement);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]