I wonder, would it make cleaner and shorter code here, if we just unfold
the `for (strtok(...) ...)` loop two times and check that both calls
succeed.

On Fri, Jun 4, 2021 at 6:20 AM enh via Toybox <toybox@lists.landley.net>
wrote:

> The intent here seems to have been to ignore lines with too few
> arguments to be valid, but since strtok() returns NULL at the end of the
> string, if you only have "verb noun", you'd be falsely rejected.
>
> Since we've kept a count anyway, just check the count.
> ---
>  toys/pending/modprobe.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> _______________________________________________
> Toybox mailing list
> Toybox@lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>


-- 

Yi-yo Chiang
Software Engineer
yochi...@google.com
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to