summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/misc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/misc.c b/src/core/misc.c
index e209efa1..4e8322fa 100644
--- a/src/core/misc.c
+++ b/src/core/misc.c
@@ -996,11 +996,10 @@ char **strsplit_len(const char *str, int len, gboolean onspace)
char **ret = g_new(char *, 1);
int n;
int split_offset = 0;
- size_t remaining_len = strlen(str);
for (n = 0; *str != '\0'; n++) {
- split_offset = MIN(len, remaining_len);
- if (onspace && remaining_len > len) {
+ split_offset = MIN(len, strlen(str));
+ if (onspace && strlen(str) > len) {
/*
* Try to find a space to split on and leave
* the space on the previous line.
@@ -1017,7 +1016,6 @@ char **strsplit_len(const char *str, int len, gboolean onspace)
ret = g_renew(char *, ret, n + 2);
str += split_offset;
- remaining_len -= split_offset;
}
ret[n] = NULL;