Re: [PATCH v2 09/10] mktree: stop setting *ntr++ to NIL
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 29, 2021, 05:01 UTC
- Message-ID
- <xmqqwnsl7kga.fsf@gitster.g>
- In-Reply-To
- <patch-09.10-e463fe5f6a-20210420T124428Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 8 quoted lines
> 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.