From: Junio C Hamano Date: Tue, 24 Apr 2018 02:38:58 GMT Subject: Re: [PATCH v4 01/11] argv_array: offer to split a string by whitespace Message-ID: In-Reply-To: Junio C Hamano writes: > Johannes Schindelin 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.