Re: First cut at git port to Cygwin
- From
- Chuck Lever <cel@citi.umich.edu>
- Date
- Oct 7, 2005, 21:29 UTC
- Message-ID
- <4346E8AC.5030503@citi.umich.edu>
- In-Reply-To
- <20051007212250.GA1423@steel.home>
Alex Riesen wrote:
Show 23 quoted lines
> Make read_cache copy the index into memory, to improve portability on
> other OS's which have mmap too, tend to use it less commonly.
>
> Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
>
> diff --git a/read-cache.c b/read-cache.c
> --- a/read-cache.c
> +++ b/read-cache.c
> @@ -497,9 +497,12 @@ int read_cache(void)
> offset = sizeof(*hdr);
> for (i = 0; i < active_nr; i++) {
> struct cache_entry *ce = map + offset;
> - offset = offset + ce_size(ce);
> - active_cache[i] = ce;
> + size_t size = ce_size(ce);
> + struct cache_entry *newce = malloc(size);
> + offset = offset + size;
> + active_cache[i] = memcpy(newce, ce, size);
> }
> + munmap(map, size);
> return active_nr;
>
> unmap:s/malloc/xmalloc/
begin:vcard fn:Chuck Lever n:Lever;Charles org:Network Appliance, Incorporated;Linux NFS Client Development adr:535 West William Street, Suite 3100;;Center for Information Technology Integration;Ann Arbor;MI;48103-4943;USA email;internet:cel@citi.umich.edu title:Member of Technical Staff tel;work:+1 734 763 4415 tel;fax:+1 734 763 4434 tel;home:+1 734 668 1089 x-mozilla-html:FALSE url:http://www.monkey.org/~cel/ version:2.1 end:vcard