Skip to content

Commit

Permalink
Rename gitfakemmap to git_mmap.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
spearce authored and Junio C Hamano committed Dec 24, 2006
1 parent 8dbc0fc commit d677912
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions compat/mmap.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#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;
Expand Down Expand Up @@ -44,7 +44,7 @@ void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_
return start;
}

int gitfakemunmap(void *start, size_t length)
int git_munmap(void *start, size_t length)
{
free(start);
return 0;
Expand Down
8 changes: 4 additions & 4 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down

0 comments on commit d677912

Please sign in to comment.