summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8dbc0fc)
raw | patch | inline | side by side (parent: 8dbc0fc)
author | Shawn O. Pearce <spearce@spearce.org> | |
Sun, 24 Dec 2006 05:45:37 +0000 (00:45 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 24 Dec 2006 08:16:56 +0000 (00:16 -0800) |
This minor cleanup was suggested by Johannes Schindelin.
The mmap is still fake in the sense that we don't support PROT_WRITE
or MAP_SHARED with external modification at all, but that hasn't
stopped us from using mmap() thoughout the Git code.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
The mmap is still fake in the sense that we don't support PROT_WRITE
or MAP_SHARED with external modification at all, but that hasn't
stopped us from using mmap() thoughout the Git code.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
compat/mmap.c | patch | blob | history | |
git-compat-util.h | patch | blob | history |
diff --git a/compat/mmap.c b/compat/mmap.c
index 0fd46e793d088e6567b20c7e81a5cde7023bdb58..bb34c7e95f6aafd6b8a433db0b2ceb0a68086817 100644 (file)
--- a/compat/mmap.c
+++ b/compat/mmap.c
#include "../git-compat-util.h"
-void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset)
+void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
{
int n = 0;
off_t current_offset = lseek(fd, 0, SEEK_CUR);
if (start != NULL || !(flags & MAP_PRIVATE))
- die("Invalid usage of gitfakemmap.");
+ die("Invalid usage of mmap when built with NO_MMAP");
if (lseek(fd, offset, SEEK_SET) < 0) {
errno = EINVAL;
return start;
}
-int gitfakemunmap(void *start, size_t length)
+int git_munmap(void *start, size_t length)
{
free(start);
return 0;
diff --git a/git-compat-util.h b/git-compat-util.h
index f79365b362ab6f5fb8333e921d6b4d25c32884d5..5d9eb2615b2e21979f547199121828aafbf02135 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -87,10 +87,10 @@ extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
#define MAP_FAILED ((void*)-1)
#endif
-#define mmap gitfakemmap
-#define munmap gitfakemunmap
-extern void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset);
-extern int gitfakemunmap(void *start, size_t length);
+#define mmap git_mmap
+#define munmap git_munmap
+extern void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
+extern int git_munmap(void *start, size_t length);
#else /* NO_MMAP */