Odd strtok usage...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




There is the occcasional use of strtok in nntpcache like this...

1	tok = strtok (xrefbuf, " \t"); /* Xref: */
2	if (tok)
3		tok = strtok (NULL, " \t"); /* Xref: foomatic.foo.com */


The test for tok on line 2 is superflous, the only way tok could be NULL 
is if xrefbuf was NULL and whoever used strtok last ran out of tokens.

I'm concerned the author might think that strtok returns NULL if no
tokens were found on the first search.  It doesn't, it returns a pointer
to the start of the string.


-- 
Aaron Nabil
nabil@teleport.com


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux