Subject: Re: [PATCH v2 09/10] mktree: stop setting *ntr++ to NIL

From: Junio C Hamano <[email-masked]>
Date: Thu, 29 Apr 2021 14:01:41 +0900

Ævar Arnfjörð Bjarmason  <[email-masked]> writes:

> Since 58ce21b819e (builtin/mktree: remove hard-coded constant,
> 2018-10-15) we have not made any subsequent use of the ntr variable
> itself, but we did rely on it to NIL-delimit the string we were about
> to feed to type_from_string().
>
> Using type_from_string() here results in needless work, as we'd do a
> strlen() on it, just to find point at which we had a SPC
> character (now NIL) earlier in this function.

Since when do we write in LISP? ;-)  The name of the ASCII character
with value 0 is NUL (null).

> We can instead skip incrementing the ntr pointer, then pass the
> pointer and length to the type_from_string() function instead.

Makes sense.  Not clobbering the input buffer is good.