]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: drop unused "sz" parameters
authorJeff King <peff@peff.net>
Thu, 14 Feb 2019 05:51:03 +0000 (00:51 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Feb 2019 23:26:15 +0000 (15:26 -0800)
commit5c326d12524e4395b0ff184123e71738db6c9f65
tree48bc43e835498a5d69591b0da04f40b8c7af8841
parent25051cac802b01a588f8170e96f97bf17869177a
ref-filter: drop unused "sz" parameters

Many of our grab_* functions, which parse the object content, take a
buf/sz pair of the object bytes. However, the functions which actually
parse the buffers (like find_wholine() and find_subpos()) never look at
"sz", and instead use functions like strchr() and strchrnul() that
assume the result is NUL-terminated.

This is OK in practice (and common for Git's parsing code), since we
always allocate an extra NUL when loading an object into memory (and
likewise, we are OK with stopping parsing if a commit or tag contains an
embedded NUL).

Let's drop these extra "sz" parameters, as they are misleading about how
the functions intend to access the buffer. We can drop from both the
functions mentioned above, which in turn lets us drop from their
callers, cascading all the way up to the top-level grab_values().

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c