On Tue, Jun 11, 2013 at 11:48:24PM +0200, Michael Haggerty wrote:
The API docs are not clear about whether it is kosher to read
lock_file::fd directly. It is only done in one file outside of
lockfile.c. So this patch stores the fd of the lockfile separately in
struct packed_ref_cache, even though the same struct also has a
pointer to the struct lock_file.
So please let me know if it is OK to read lock_file::fd directly. If
so, then I will drop the fd member of struct packed_ref_cache, as well
as the local variable "fd" in lock_packed_refs().
I think it's fine; the fact that you have such an fd is a public part of
the interface, so you are only relying on the struct member being there.
And since the lock_file must hold the fd itself somewhere, I don't think
that's unreasonable.
I'm not sure how you got your "in one file" list, but it appears to
happen in credential-store.c, bundle.c, fast-import.c, and read-cache.c.
-Peff