Skip to content
  • Jeff King's avatar
    ref-filter: drop unused "sz" parameters · 5c326d12
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    5c326d12