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>
This commit is contained in:
parent
8dbc0fcef4
commit
d6779124b9
@ -1,12 +1,12 @@
|
|||||||
#include "../git-compat-util.h"
|
#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;
|
int n = 0;
|
||||||
off_t current_offset = lseek(fd, 0, SEEK_CUR);
|
off_t current_offset = lseek(fd, 0, SEEK_CUR);
|
||||||
|
|
||||||
if (start != NULL || !(flags & MAP_PRIVATE))
|
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) {
|
if (lseek(fd, offset, SEEK_SET) < 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@ -44,7 +44,7 @@ void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_
|
|||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gitfakemunmap(void *start, size_t length)
|
int git_munmap(void *start, size_t length)
|
||||||
{
|
{
|
||||||
free(start);
|
free(start);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -87,10 +87,10 @@ extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
|
|||||||
#define MAP_FAILED ((void*)-1)
|
#define MAP_FAILED ((void*)-1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define mmap gitfakemmap
|
#define mmap git_mmap
|
||||||
#define munmap gitfakemunmap
|
#define munmap git_munmap
|
||||||
extern void *gitfakemmap(void *start, size_t length, int prot , int flags, int fd, off_t offset);
|
extern void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset);
|
||||||
extern int gitfakemunmap(void *start, size_t length);
|
extern int git_munmap(void *start, size_t length);
|
||||||
|
|
||||||
#else /* NO_MMAP */
|
#else /* NO_MMAP */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user