mirror of
https://github.com/moparisthebest/curl
synced 2025-01-01 17:08:00 -05:00
re-indented to follow "project curl"-style, renamed curl_ prefix to Curl_
This commit is contained in:
parent
d567659bf4
commit
88d536eb3b
31
lib/strtok.c
31
lib/strtok.c
@ -72,32 +72,28 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
char *
|
char *
|
||||||
curl_strtok_r(char *s, const char *delim, char **last)
|
Curl_strtok_r(char *s, const char *delim, char **last)
|
||||||
{
|
{
|
||||||
char *spanp;
|
char *spanp;
|
||||||
int c, sc;
|
int c, sc;
|
||||||
char *tok;
|
char *tok;
|
||||||
|
|
||||||
if (s == NULL && (s = *last) == NULL)
|
if (s == NULL && (s = *last) == NULL) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
||||||
*/
|
*/
|
||||||
cont:
|
cont:
|
||||||
c = *s++;
|
c = *s++;
|
||||||
for (spanp = (char *)delim; (sc = *spanp++) != 0; )
|
for (spanp = (char *)delim; (sc = *spanp++) != 0; ) {
|
||||||
{
|
if (c == sc) {
|
||||||
if (c == sc)
|
|
||||||
{
|
|
||||||
goto cont;
|
goto cont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == 0) /* no non-delimiter characters */
|
if (c == 0) { /* no non-delimiter characters */
|
||||||
{
|
|
||||||
*last = NULL;
|
*last = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -107,20 +103,15 @@ cont:
|
|||||||
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
||||||
* Note that delim must have one NUL; we stop if we see that, too.
|
* Note that delim must have one NUL; we stop if we see that, too.
|
||||||
*/
|
*/
|
||||||
for (;;)
|
for (;;) {
|
||||||
{
|
|
||||||
c = *s++;
|
c = *s++;
|
||||||
spanp = (char *)delim;
|
spanp = (char *)delim;
|
||||||
do
|
do {
|
||||||
{
|
if ((sc = *spanp++) == c) {
|
||||||
if ((sc = *spanp++) == c)
|
if (c == 0) {
|
||||||
{
|
|
||||||
if (c == 0)
|
|
||||||
{
|
|
||||||
s = NULL;
|
s = NULL;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
char *w = s - 1;
|
char *w = s - 1;
|
||||||
*w = '\0';
|
*w = '\0';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user