Re: [PATCH] Fix random fast-import errors when compiled with NO_MMAP
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Jan 21, 2008, 04:10 UTC
- Message-ID
- <20080121041031.GF24004@spearce.org>
- In-Reply-To
- <7vtzlbirz0.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> wrote:
Show 6 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes: > > > +extern void close_pack_windows(struct packed_git *, int); > > Nobody seems to pass anything but true in retain_fd parameter. > Is it worth it?
Hmm, well, I originally wrote something like what you fixed it to be, then thought that at some point in the future someone may try to invoke the method and expect different semantics than it implemented. :-)
In short I made the implementation I gave you way too complex.
Show 17 quoted lines
> So I'd prefer something much simpler like this one instead...
>
> void close_pack_windows(struct packed_git *p)
> {
> while (p->windows) {
> struct pack_window *w = p->windows;
>
> if (w->inuse_cnt)
> die("pack '%s' still has outstanding windows",
> p->pack_name)
> munmap(w->base, w->len);
> pack_mapped -= w->len;
> pack_open_windows--;
> p->windows = w->next;
> free(w);
> }
> }Me too. Thank you for the sanity check, and for fixing the code to actually be somewhat sane.
-- Shawn.