@matheusbsbs / matheus-bagliano / commits / d6779124b9
Fork 0

Rename gitfakemmap to git_mmap.

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>

Shawn O. Pearce committed Dec 24, 2006 at 00:45 UTC d6779124b90ef5c00697815b04c9f75fd3756586
2 files changed +7 -7
compat/mmap.c
+3 -3
@@ -1,12 +1,12 @@
1 #include "../git-compat-util.h"
2
3 -void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset)
3 +void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
4 {
5 int n = 0;
6 off_t current_offset = lseek(fd, 0, SEEK_CUR);
7
8 if (start != NULL || !(flags & MAP_PRIVATE))
9 - die("Invalid usage of gitfakemmap.");
9 + die("Invalid usage of mmap when built with NO_MMAP");
10
11 if (lseek(fd, offset, SEEK_SET) < 0) {
12 errno = EINVAL;
@@ -44,7 +44,7 @@ void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_
44 return start;
45 }
46
47 -int gitfakemunmap(void *start, size_t length)
47 +int git_munmap(void *start, size_t length)
48 {
49 free(start);
50 return 0;
git-compat-util.h
+4 -4
@@ -87,10 +87,10 @@ extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
87 #define MAP_FAILED ((void*)-1)
88 #endif
89
90 -#define mmap gitfakemmap
91 -#define munmap gitfakemunmap
92 -extern void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset);
93 -extern int gitfakemunmap(void *start, size_t length);
90 +#define mmap git_mmap
91 +#define munmap git_munmap
92 +extern void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
93 +extern int git_munmap(void *start, size_t length);
94
95 #else /* NO_MMAP */
96