diff options
author | Russell Belfer <arrbee@arrbee.com> | 2012-03-13 14:23:24 -0700 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2012-03-13 14:23:24 -0700 |
commit | e3c475107045cb89c53c114716bafebc7538433f (patch) | |
tree | eb6df56dc41633a30a935058477e45b8e39ef77a /src/map.h | |
parent | 1736799d2a15d912cfc46b7089c2bff02a1cbd0e (diff) | |
download | libgit2-e3c475107045cb89c53c114716bafebc7538433f.tar.gz |
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.h | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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); |