diff options
| author | Russell Belfer <arrbee@arrbee.com> | 2012-02-28 16:14:47 -0800 |
|---|---|---|
| committer | Russell Belfer <arrbee@arrbee.com> | 2012-03-02 15:49:29 -0800 |
| commit | 74fa4bfae37e9d7c9e35550c881b114d7a83c4fa (patch) | |
| tree | 98184643a8c42b1402e4b33f835eac424fe88768 /src/fileops.h | |
| parent | 760db29c456ef2029a81d577d95a3fafb37ce5c6 (diff) | |
| download | libgit2-74fa4bfae37e9d7c9e35550c881b114d7a83c4fa.tar.gz | |
Update diff to use iterators
This is a major reorganization of the diff code. This changes
the diff functions to use the iterators for traversing the
content. This allowed a lot of code to be simplified. Also,
this moved the functions relating to outputting a diff into a
new file (diff_output.c).
This includes a number of other changes - adding utility
functions, extending iterators, etc. plus more tests for the
diff code. This also takes the example diff.c program much
further in terms of emulating git-diff command line options.
Diffstat (limited to 'src/fileops.h')
| -rw-r--r-- | src/fileops.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/fileops.h b/src/fileops.h index 43ef21521..ab57b6f38 100644 --- a/src/fileops.h +++ b/src/fileops.h @@ -81,6 +81,10 @@ extern int git_futils_mv_withpath(const char *from, const char *to, const mode_t */ extern git_off_t git_futils_filesize(git_file fd); +#define GIT_MODE_PERMS_MASK 0777 +#define GIT_CANONICAL_PERMS(MODE) (((MODE) & 0100) ? 0755 : 0644) +#define GIT_MODE_TYPE(MODE) ((MODE) & ~GIT_MODE_PERMS_MASK) + /** * Convert a mode_t from the OS to a legal git mode_t value. */ @@ -109,6 +113,19 @@ extern int git_futils_mmap_ro( size_t len); /** + * Read-only map an entire file. + * + * @param out buffer to populate with the mapping information. + * @param path path to file to be opened. + * @return + * - GIT_SUCCESS on success; + * - GIT_EOSERR on an unspecified OS related error. + */ +extern int git_futils_mmap_ro_file( + git_map *out, + const char *path); + +/** * Release the memory associated with a previous memory mapping. * @param map the mapping description previously configured. */ |
