From: Daniel Carl <danielcarl@gmx.de>
Date: Thu, 31 Jul 2014 16:01:14 +0000 (+0200)
Subject: Removed unused param for util_str_replace.
X-Git-Url: https://git.owens.tech/projects.html/projects.html/git?a=commitdiff_plain;h=46df33d1b67ab47fc91b2772521d83cb4ab086a0;p=vimb.git

Removed unused param for util_str_replace.
---

diff --git a/src/shortcut.c b/src/shortcut.c
index 23691dc..190f92f 100644
--- a/src/shortcut.c
+++ b/src/shortcut.c
@@ -84,7 +84,7 @@ char *shortcut_get_uri(const char *string)
     /* if there are only $0 placeholders we don't need to split the parameters */
     if (max_num == 0) {
         quoted_param = soup_uri_encode(query, "&");
-        uri          = util_str_replace("$0", quoted_param, tmpl, -1);
+        uri          = util_str_replace("$0", quoted_param, tmpl);
         g_free(quoted_param);
 
         return uri;
@@ -141,7 +141,7 @@ char *shortcut_get_uri(const char *string)
             char *new;
 
             quoted_param = soup_uri_encode(token->str, "&");
-            new = util_str_replace((char[]){'$', current_num + '0', '\0'}, quoted_param, uri, -1);
+            new = util_str_replace((char[]){'$', current_num + '0', '\0'}, quoted_param, uri);
             g_free(quoted_param);
             g_free(uri);
             uri = new;
diff --git a/src/util.c b/src/util.c
index 84612ec..00f6438 100644
--- a/src/util.c
+++ b/src/util.c
@@ -253,13 +253,13 @@ next:
  * Replaces appearances of search in string by given replace.
  * Returne a new allocated string if search was found.
  */
-char *util_str_replace(const char* search, const char* replace, const char* string, int max_replaces)
+char *util_str_replace(const char* search, const char* replace, const char* string)
 {
     if (!string) {
         return NULL;
     }
 
-    char **buf = g_strsplit(string, search, max_replaces + 1);
+    char **buf = g_strsplit(string, search, -1);
     char *ret  = g_strjoinv(replace, buf);
     g_strfreev(buf);
 
diff --git a/src/util.h b/src/util.h
index cd6165c..5c7b4d4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -43,7 +43,7 @@ GList *util_file_to_unique_list(const char *filename, Util_Content_Func func,
 gboolean util_file_append(const char *file, const char *format, ...);
 gboolean util_file_prepend(const char *file, const char *format, ...);
 char* util_strcasestr(const char* haystack, const char* needle);
-char *util_str_replace(const char* search, const char* replace, const char* string, int max_replaces);
+char *util_str_replace(const char* search, const char* replace, const char* string);
 gboolean util_create_tmp_file(const char *content, char **file);
 char *util_build_path(const char *path, const char *dir);
 char *util_expand(const char *src, int expflags);