diff options
| author | Ben Straub <bs@github.com> | 2012-11-30 20:34:50 -0800 |
|---|---|---|
| committer | Ben Straub <bs@github.com> | 2012-11-30 20:34:50 -0800 |
| commit | 0ab3a2ab2c39a99b7cb3c969fd7b896afcec4885 (patch) | |
| tree | ab8f3c0aa63a7c27098c12a8b7f049008b396378 /src/common.h | |
| parent | c7231c45fecf6c0ae91815a82db7e98c94689497 (diff) | |
| download | libgit2-0ab3a2ab2c39a99b7cb3c969fd7b896afcec4885.tar.gz | |
Deploy GIT_INIT_STRUCTURE
Diffstat (limited to 'src/common.h')
| -rw-r--r-- | src/common.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h index b779d2800..3e7b0658f 100644 --- a/src/common.h +++ b/src/common.h @@ -82,6 +82,16 @@ GIT_INLINE(bool) giterr__check_version(const void *structure, unsigned int expec } #define GITERR_CHECK_VERSION(S,V,N) if (!giterr__check_version(S,V,N)) return -1 +/** + * Initialize a structure with a version. + */ +GIT_INLINE(void) git__init_structure(void *structure, size_t len, unsigned int version) +{ + memset(structure, 0, len); + *((int*)structure) = version; +} +#define GIT_INIT_STRUCTURE(S,V) git__init_structure(S, sizeof(*S), V) + /* NOTE: other giterr functions are in the public errors.h header file */ #include "util.h" |
