summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index 8f54144..84612ec 100644
--- a/src/util.c
+++ b/src/util.c
@@ -251,15 +251,15 @@ next:
/**
* Replaces appearances of search in string by given replace.
- * Returne a new allocated string of search was found.
+ * Returne a new allocated string if search was found.
*/
-char *util_str_replace(const char* search, const char* replace, const char* string)
+char *util_str_replace(const char* search, const char* replace, const char* string, int max_replaces)
{
if (!string) {
return NULL;
}
- char **buf = g_strsplit(string, search, -1);
+ char **buf = g_strsplit(string, search, max_replaces + 1);
char *ret = g_strjoinv(replace, buf);
g_strfreev(buf);