Thread (1 message) 1 message, 1 author, 2021-04-29

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

From: Junio C Hamano <hidden>
Date: 2021-04-29 05:01:47

Ævar Arnfjörð Bjarmason  [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help