git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/7] Rename gitfakemmap to git_mmap.

From
Shawn O. Pearce <spearce@spearce.org>
Date
Dec 24, 2006, 05:45 UTC
Message-ID
<20061224054537.GA8146@spearce.org>
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>
---
 compat/mmap.c     |    6 +++---
 git-compat-util.h |    8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/compat/mmap.c b/compat/mmap.c
index 0fd46e7..bb34c7e 100644
--- a/compat/mmap.c
+++ b/compat/mmap.c
@@ -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;
@@ -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;
diff --git a/git-compat-util.h b/git-compat-util.h
index f79365b..5d9eb26 100644
--- 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 */
 
-- 
1.4.4.3.g2e63
Message 1 of 1 in “Rename gitfakemmap to git_mmap.”
  1. 1/7 Rename gitfakemmap to git_mmap.Shawn O. Pearce, Dec 24, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.