git/refs
Jeff King 765b496dc6 pass st.st_size as hint for strbuf_readlink()
When we initially added the strbuf_readlink() function in
b11b7e13f4 (Add generic 'strbuf_readlink()' helper function,
2008-12-17), the point was that we generally have a _guess_
as to the correct size based on the stat information, but we
can't necessarily trust it.

Over the years, a few callers have grown up that simply pass
in 0, even though they have the stat information. Let's have
them pass in their hint for consistency (and in theory
efficiency, since it may avoid an extra resize/syscall loop,
but neither location is probably performance critical).

Note that st.st_size is actually an off_t, so in theory we
need xsize_t() here. But none of the other callsites use it,
and since this is just a hint, it doesn't matter either way
(if we wrap we'll simply start with a too-small hint and
then eventually complain when we cannot allocate the
memory).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-07-24 10:19:29 -07:00
..
files-backend.c pass st.st_size as hint for strbuf_readlink() 2018-07-24 10:19:29 -07:00
iterator.c Replace all die("BUG: ...") calls by BUG() ones 2018-05-06 19:06:13 +09:00
packed-backend.c Replace all die("BUG: ...") calls by BUG() ones 2018-05-06 19:06:13 +09:00
packed-backend.h files-backend: don't rewrite the packed-refs file unnecessarily 2017-10-30 09:45:15 +09:00
ref-cache.c Replace all die("BUG: ...") calls by BUG() ones 2018-05-06 19:06:13 +09:00
ref-cache.h ref_cache: remove support for storing peeled values 2017-09-25 18:02:46 +09:00
refs-internal.h refs: update some more docs to use "oid" rather than "sha1" 2017-11-06 10:31:08 +09:00