]> git.ipfire.org Git - thirdparty/git.git/commit - refs/files-backend.c
read_raw_ref(): manage own scratch space
authorMichael Haggerty <mhagger@alum.mit.edu>
Thu, 7 Apr 2016 19:03:02 +0000 (15:03 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sun, 10 Apr 2016 18:35:26 +0000 (11:35 -0700)
commit42a38cf788428bf39db1729ee8c79c64252a2849
tree9da153c610ce20707eac39cec0fcd248f65aba21
parent7048653a7351df6049e2306a51b0a06b83aa181b
read_raw_ref(): manage own scratch space

Instead of creating scratch space in resolve_ref_unsafe() and passing
it down through resolve_ref_1 to read_raw_ref(), teach read_raw_ref()
to manage its own scratch space. This reduces coupling across the
functions at the cost of some extra allocations.

Also, when read_raw_ref() is implemented for different reference
backends, the other implementations might have different scratch
space requirements.

Note that we now preserve errno across the calls to strbuf_release(),
which calls free() and can thus theoretically overwrite errno.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs/files-backend.c