[epiphany/mwleeds/webapp-dbus-api: 13/17] lib: Use g_string_replace() internally
- From: Phaedrus Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mwleeds/webapp-dbus-api: 13/17] lib: Use g_string_replace() internally
- Date: Tue, 15 Mar 2022 22:06:44 +0000 (UTC)
commit f270213662b25d4897d3b98572aee10c93aaa3f5
Author: Phaedrus Leeds <mwleeds protonmail com>
Date: Tue Feb 22 13:55:30 2022 -0800
lib: Use g_string_replace() internally
This should introduce no functional changes.
lib/ephy-string.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
---
diff --git a/lib/ephy-string.c b/lib/ephy-string.c
index dd434e1b8..73e854c93 100644
--- a/lib/ephy-string.c
+++ b/lib/ephy-string.c
@@ -244,23 +244,13 @@ ephy_string_find_and_replace (const char *haystack,
const char *to_repl)
{
GString *str;
- const char *tmp;
- gsize to_find_len;
- gsize pos;
g_assert (haystack);
g_assert (to_find);
g_assert (to_repl);
str = g_string_new (haystack);
- to_find_len = strlen (to_find);
-
- while ((tmp = strstr (str->str, to_find)) != NULL) {
- pos = tmp - str->str;
- g_string_erase (str, pos, to_find_len);
- g_string_insert (str, pos, to_repl);
- }
-
+ g_string_replace (str, to_find, to_repl, 0);
return g_string_free (str, FALSE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]