Junio C Hamano <gits...@pobox.com> writes:

> Johannes Schindelin <johannes.schinde...@gmx.de> writes:
>
>> +void argv_array_split(struct argv_array *array, const char *to_split)
>> +{
>> +    while (isspace(*to_split))
>> +            to_split++;
>> +    for (;;) {
>> +            const char *p = to_split;
>> +
>> +            if (!*p)
>> +                    break;
>> +
>> +            while (*p && !isspace(*p))
>> +                    p++;
>> +            argv_array_push_nodup(array, xstrndup(to_split, p - to_split));
>
> Can *p be '\0' at this point?

My thinko.  We do want to stop on NUL even though our isspace() says
NUL is not a space.  And using while (isspace(*p)) below without
checking for NUL also makes sense.

Sorry for the noise.



Reply via email to