carp
carp copied to clipboard
strtok function?
There is something in the below I don't understand...to me the result of strtok is redundant because its inputs are constants. Is there something I am missing out?
See https://github.com/tekknolagi/carp/blob/master/src/carp_tokenizer.c#L112
toks = strtok(NULL, delim);
if (toks != NULL) {
parsed->next = malloc(sizeof *parsed->next);
lookbehind = parsed;
parsed = parsed->next;
}
As I understand the man page, strtok
maintains its own state, and subsequent calls to tokenize a string must call strtok
with NULL
as the first argument: http://linux.die.net/man/3/strtok
If I have misunderstood, please correct me.
All that being said, I do plan on rewriting this tokenizer entirely.