path: root/wrapper.c
diff options
authorJonathan Nieder <>2010-11-06 11:44:11 (GMT)
committerJunio C Hamano <>2010-11-10 19:03:13 (GMT)
commit58ecbd5edeb2357c313db75bc49d45981a2061b7 (patch)
tree2b1c2369102ae51b351bdbb2a0a3ad837bb4bdaf /wrapper.c
parent6f10c4103dc7506623f89520ad03517b40788259 (diff)
wrapper: move xmmap() to sha1_file.c
wrapper.o depends on sha1_file.o for a number of reasons. One is release_pack_memory(). xmmap function calls mmap, discarding unused pack windows when necessary to relieve memory pressure. Simple git programs using wrapper.o as a friendly libc do not need this functionality. So move xmmap to sha1_file.o, where release_pack_memory() is. Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'wrapper.c')
1 files changed, 0 insertions, 15 deletions
diff --git a/wrapper.c b/wrapper.c
index fd8ead3..3195ef3 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -108,21 +108,6 @@ void *xcalloc(size_t nmemb, size_t size)
return ret;
-void *xmmap(void *start, size_t length,
- int prot, int flags, int fd, off_t offset)
- void *ret = mmap(start, length, prot, flags, fd, offset);
- if (ret == MAP_FAILED) {
- if (!length)
- return NULL;
- release_pack_memory(length, fd);
- ret = mmap(start, length, prot, flags, fd, offset);
- if (ret == MAP_FAILED)
- die_errno("Out of memory? mmap failed");
- }
- return ret;
* xread() is the same a read(), but it automatically restarts read()
* operations with a recoverable error (EAGAIN and EINTR). xread()