diff options
| author | Matthew Bowen <matthew@mgbowen.com> | 2014-03-05 21:49:23 -0500 |
|---|---|---|
| committer | Matthew Bowen <matthew@mgbowen.com> | 2014-03-05 21:49:23 -0500 |
| commit | b9f819978c571cc806827e8b3ebc1a58a0755999 (patch) | |
| tree | 64c94ef334360b064a3bdf9b6069c1422f727150 /include/git2/sys | |
| parent | a064dc2d0b6206116a35be4b62c58c3c1170d5de (diff) | |
| download | libgit2-b9f819978c571cc806827e8b3ebc1a58a0755999.tar.gz | |
Added function-based initializers for every options struct.
The basic structure of each function is courtesy of arrbee.
Diffstat (limited to 'include/git2/sys')
| -rw-r--r-- | include/git2/sys/config.h | 13 | ||||
| -rw-r--r-- | include/git2/sys/odb_backend.h | 13 | ||||
| -rw-r--r-- | include/git2/sys/refdb_backend.h | 13 |
3 files changed, 39 insertions, 0 deletions
diff --git a/include/git2/sys/config.h b/include/git2/sys/config.h index 419ad7ea7..3df2ba327 100644 --- a/include/git2/sys/config.h +++ b/include/git2/sys/config.h @@ -70,6 +70,19 @@ struct git_config_backend { #define GIT_CONFIG_BACKEND_INIT {GIT_CONFIG_BACKEND_VERSION} /** + * Initializes a `git_config_backend` with default values. Equivalent to + * creating an instance with GIT_CONFIG_BACKEND_INIT. + * + * @param opts the `git_config_backend` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_CONFIG_BACKEND_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_config_init_backend( + git_config_backend* backend, + int version); + +/** * Add a generic config file instance to an existing config * * Note that the configuration object will free the file diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h index 4917ba0f0..81bb082e6 100644 --- a/include/git2/sys/odb_backend.h +++ b/include/git2/sys/odb_backend.h @@ -89,6 +89,19 @@ struct git_odb_backend { #define GIT_ODB_BACKEND_VERSION 1 #define GIT_ODB_BACKEND_INIT {GIT_ODB_BACKEND_VERSION} +/** + * Initializes a `git_odb_backend` with default values. Equivalent to + * creating an instance with GIT_ODB_BACKEND_INIT. + * + * @param opts the `git_odb_backend` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_ODB_BACKEND_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_odb_init_backend( + git_odb_backend* backend, + int version); + GIT_EXTERN(void *) git_odb_backend_malloc(git_odb_backend *backend, size_t len); GIT_END_DECL diff --git a/include/git2/sys/refdb_backend.h b/include/git2/sys/refdb_backend.h index aa5ef9ecc..dce142c77 100644 --- a/include/git2/sys/refdb_backend.h +++ b/include/git2/sys/refdb_backend.h @@ -159,6 +159,19 @@ struct git_refdb_backend { #define GIT_REFDB_BACKEND_INIT {GIT_REFDB_BACKEND_VERSION} /** + * Initializes a `git_refdb_backend` with default values. Equivalent to + * creating an instance with GIT_REFDB_BACKEND_INIT. + * + * @param opts the `git_refdb_backend` instance to initialize. + * @param version the version of the struct; you should pass + * `GIT_REFDB_BACKEND_VERSION` here. + * @return Zero on success; -1 on failure. + */ +GIT_EXTERN(int) git_refdb_init_backend( + git_refdb_backend* backend, + int version); + +/** * Constructors for default filesystem-based refdb backend * * Under normal usage, this is called for you when the repository is |
