summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-11-09 06:33:08 -0300
committerdequis <dx@dxzone.com.ar>2015-11-09 06:33:08 -0300
commit8736c12fc95ca977f4fc4a947c760bac651cd3af (patch)
tree38f6606d2319bb9968775bf40c8838a5b405b6a1 /src/core
parented28483e7509f0a7a75716f2651f603824fd9817 (diff)
downloadirssi-8736c12fc95ca977f4fc4a947c760bac651cd3af.zip
strsplit_len: use strlen() directly instead of a remaining_len variable
Diffstat (limited to 'src/core')
-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;