[gnome-todo] utils: Pass source length to g_strstr_len()
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-todo] utils: Pass source length to g_strstr_len()
- Date: Mon, 5 Feb 2018 01:04:28 +0000 (UTC)
commit f81a3156ca33aa8e40f0d0e076d0e189922c7428
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Sun Feb 4 22:37:01 2018 -0200
utils: Pass source length to g_strstr_len()
This might avoid an strlen.
src/gtd-utils.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gtd-utils.c b/src/gtd-utils.c
index 0e33d02..636ad81 100644
--- a/src/gtd-utils.c
+++ b/src/gtd-utils.c
@@ -45,7 +45,7 @@ gtd_str_replace (const gchar *source,
replacement_len = strlen (replacement);
n_ocurrences = 0;
- for (source_aux = g_strstr_len (source, -1, search);
+ for (source_aux = g_strstr_len (source, source_len, search);
source_aux != NULL;
source_aux = g_strstr_len (source_aux + search_len, -1, search))
{
@@ -67,7 +67,7 @@ gtd_str_replace (const gchar *source,
source_aux2 = source;
new_aux = new_string;
- for (source_aux = g_strstr_len (source, -1, search);
+ for (source_aux = g_strstr_len (source, source_len, search);
source_aux != NULL;
source_aux = g_strstr_len (source_aux + search_len, -1, search))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]