summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/strtok_r.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/strtok_r.c b/lib/strtok_r.c
index cead029a2..8a5284a42 100644
--- a/lib/strtok_r.c
+++ b/lib/strtok_r.c
@@ -19,7 +19,7 @@ char *xine_private_strtok_r(char *s, const char *delim, char **ptrptr) {
else s = *ptrptr;
/* end of searching */
- if (!s || s == '\0') return NULL;
+ if (!s || !*s) return NULL;
/* cut the initial garbage */
cutlen = strspn(s, delim);
@@ -32,12 +32,12 @@ char *xine_private_strtok_r(char *s, const char *delim, char **ptrptr) {
}
next = s + toklen;
+ /* prepare next call */
+ *ptrptr = *next ? next + 1 : NULL;
+
/* cut current token */
*next = '\0';
- /* prepare next call */
- *ptrptr = next + 1;
-
/* return the token */
return s;
}