diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2013-05-25 11:08:24 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-06-02 15:28:47 -0700 |
commit | 4f78c24c63bf0b035afc02372727a3b5897d9835 (patch) | |
tree | 6086fc02afe91c94a07349f5e81d52f6cfc61c2f /contrib/persistent-https | |
parent | register_ref(): make a copy of the bad reference SHA-1 (diff) | |
download | tgif-4f78c24c63bf0b035afc02372727a3b5897d9835.tar.xz |
refs: document the lifetime of the args passed to each_ref_fn
The lifetime of the memory pointed to by the refname and sha1
arguments to each_ref_fn was never documented, but some callers used
to assume that it was essentially permanent. In fact the API does
*not* guarantee that these objects live beyond a single callback
invocation.
In the current code, the lifetimes are bound together with the
lifetimes of the ref_caches. Since these are usually long, the
callers usually got away with their sloppiness. But even today, if a
ref_cache is invalidated the memory can be freed. And planned changes
to reference caching, needed to eliminate race conditions, will
probably need to shorten the lifetimes of these objects.
The commits leading up to this have (hopefully) fixed all of the
callers of the for_each_ref()-like functions. This commit does the
last step: documents what each_ref_fn callbacks can assume about
object lifetimes.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions