Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/map.h
diff options
context:
space:
mode:
authorRussell Belfer <arrbee@arrbee.com>2012-03-14 01:23:24 +0400
committerRussell Belfer <arrbee@arrbee.com>2012-03-14 01:23:24 +0400
commite3c475107045cb89c53c114716bafebc7538433f (patch)
treeeb6df56dc41633a30a935058477e45b8e39ef77a /src/map.h
parent1736799d2a15d912cfc46b7089c2bff02a1cbd0e (diff)
Resolve comments from pull request
This converts the map validation function into a macro, tweaks the GITERR_OS system error automatic appending, and adds a tentative new error access API and some quick unit tests for both the old and new error APIs.
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/map.h b/src/map.h
index d0ca1ee56..96d879547 100644
--- a/src/map.h
+++ b/src/map.h
@@ -31,7 +31,10 @@ typedef struct { /* memory mapped buffer */
#endif
} git_map;
-extern int validate_map_args(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset);
+#define GIT_MMAP_VALIDATE(out, len, prot, flags) do { \
+ assert(out != NULL && len > 0); \
+ assert((prot & GIT_PROT_WRITE) || (prot & GIT_PROT_READ)); \
+ assert((flags & GIT_MAP_FIXED) == 0); } while (0)
extern int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset);
extern int p_munmap(git_map *map);