aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorkwolekr <mirrorisim@gmail.com>2013-01-23 17:37:53 -0500
committerkwolekr <mirrorisim@gmail.com>2013-01-23 17:37:53 -0500
commit9d69b3858385e657a3d1a8b64d302c0bd5a23166 (patch)
treea8b8e5c5050d34d8f3b14226affffa9c1fb74999 /src/util
parent69ba4854152415ab3e2ec11cdb6f9c9ce5af9ac8 (diff)
downloadminetest-9d69b3858385e657a3d1a8b64d302c0bd5a23166.tar.gz
minetest-9d69b3858385e657a3d1a8b64d302c0bd5a23166.tar.bz2
minetest-9d69b3858385e657a3d1a8b64d302c0bd5a23166.zip
Slightly improved version of mystrtok_r
Diffstat (limited to 'src/util')
-rw-r--r--src/util/string.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp
index 481e74dad..c10755ae1 100644
--- a/src/util/string.cpp
+++ b/src/util/string.cpp
@@ -50,7 +50,6 @@ size_t curl_write_data(char *ptr, size_t size, size_t nmemb, void *userdata) {
char *mystrtok_r(char *s, const char *sep, char **lasts) {
char *t;
- int delim_reached;
if (!s)
s = *lasts;
@@ -61,15 +60,11 @@ char *mystrtok_r(char *s, const char *sep, char **lasts) {
if (!*s)
return NULL;
- delim_reached = 0;
t = s;
while (*t) {
if (strchr(sep, *t)) {
- *t = '\0';
- delim_reached = 1;
- } else if (delim_reached) {
- *lasts = t;
- return s;
+ *t++ = '\0';
+ break;
}
t++;
}