Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9221 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
01a9b4267c
commit
3451283511
@ -3,11 +3,14 @@
|
|||||||
** Distributed under the terms of the NewOS License.
|
** Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
static char *___strtok = NULL;
|
static char *___strtok = NULL;
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strtok_r(char *s, char const *ct, char **save_ptr)
|
strtok_r(char *s, char const *ct, char **save_ptr)
|
||||||
{
|
{
|
||||||
@ -17,15 +20,16 @@ strtok_r(char *s, char const *ct, char **save_ptr)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
sbegin = s ? s : *save_ptr;
|
sbegin = s ? s : *save_ptr;
|
||||||
if (!sbegin) {
|
if (!sbegin)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
sbegin += strspn(sbegin,ct);
|
sbegin += strspn(sbegin, ct);
|
||||||
if (*sbegin == '\0') {
|
if (*sbegin == '\0') {
|
||||||
if (save_ptr)
|
if (save_ptr)
|
||||||
*save_ptr = NULL;
|
*save_ptr = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
send = strpbrk(sbegin, ct);
|
send = strpbrk(sbegin, ct);
|
||||||
if (send && *send != '\0')
|
if (send && *send != '\0')
|
||||||
*send++ = '\0';
|
*send++ = '\0';
|
||||||
@ -35,6 +39,7 @@ strtok_r(char *s, char const *ct, char **save_ptr)
|
|||||||
return sbegin;
|
return sbegin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
strtok(char *s, char const *ct)
|
strtok(char *s, char const *ct)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user