Slightly improved version of mystrtok_r

This commit is contained in:
kwolekr 2013-01-23 17:37:53 -05:00
parent 69ba485415
commit 9d69b38583
1 changed files with 2 additions and 7 deletions

View File

@ -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++;
}