summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorDaniel Carl <danielcarl@gmx.de>2014-07-31 01:16:38 +0200
committerDaniel Carl <danielcarl@gmx.de>2014-07-31 01:16:38 +0200
commit92413f9aa0097150c74b00f5690fd5d7b74c53de (patch)
tree6823b046a0b705825afb718790b48a3cf0817d98 /src/util.c
parent555458c31ff9d6bb6232513dd5229b94e9158b90 (diff)
Implemented extended :set syntax.
Added the new :set flavours :set option+=..., :set option-=..., set option^=... like in vim.
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);