summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2013-05-25 09:08:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-06-02 22:28:47 (GMT)
commit4f78c24c63bf0b035afc02372727a3b5897d9835 (patch)
tree6086fc02afe91c94a07349f5e81d52f6cfc61c2f /builtin/fetch.c
parentbf42772e38db8e758aa28a045e8cba88096a9fcc (diff)
downloadgit-4f78c24c63bf0b035afc02372727a3b5897d9835.zip
git-4f78c24c63bf0b035afc02372727a3b5897d9835.tar.gz
git-4f78c24c63bf0b035afc02372727a3b5897d9835.tar.bz2
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 'builtin/fetch.c')
0 files changed, 0 insertions, 0 deletions