[vala/wip/housekeeping: 1/4] 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/wip/housekeeping: 1/4] glib-2.0: Add simple fast-path to string.replace()
- Date: Thu, 3 Nov 2016 18:38:07 +0000 (UTC)
commit 892e1fb962ab0ee77c7b178e2fd18467ce85199c
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..5db76c0 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]