diff options
| author | Nico von Geyso <Nico.Geyso@FU-Berlin.de> | 2013-03-18 21:02:36 +0100 |
|---|---|---|
| committer | Carlos MartÃn Nieto <cmn@dwim.me> | 2013-08-08 11:14:53 +0200 |
| commit | a603c191578f7b33720e36e95421fcd58bc7abe4 (patch) | |
| tree | 4de06cb51a580e85e5be38c91bbdfe980b4a55b5 /include/git2/config.h | |
| parent | 6385fc5ff5d669d3ec99d89f19c5860cf53011ba (diff) | |
| download | libgit2-a603c191578f7b33720e36e95421fcd58bc7abe4.tar.gz | |
replaced foreach() with non callback based iterations in git_config_backend
new functions in struct git_config_backend:
* iterator_new(...)
* iterator_free(...)
* next(...)
The old callback based foreach style can still be used with `git_config_backend_foreach_match`
Diffstat (limited to 'include/git2/config.h')
| -rw-r--r-- | include/git2/config.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/git2/config.h b/include/git2/config.h index 827d43544..f6fc74ee1 100644 --- a/include/git2/config.h +++ b/include/git2/config.h @@ -61,6 +61,7 @@ typedef struct { } git_config_entry; typedef int (*git_config_foreach_cb)(const git_config_entry *, void *); +typedef struct git_config_backend_iter* git_config_backend_iter; typedef enum { GIT_CVAR_FALSE = 0, @@ -535,6 +536,25 @@ GIT_EXTERN(int) git_config_parse_int32(int32_t *out, const char *value); GIT_EXTERN(int) git_config_parse_int64(int64_t *out, const char *value); +/** + * Perform an operation on each config variable in given config backend + * matching a regular expression. + * + * This behaviors like `git_config_foreach_match` except instead of all config + * entries it just enumerates through the given backend entry. + * + * @param backend where to get the variables from + * @param regexp regular expression to match against config names (can be NULL) + * @param callback the function to call on each variable + * @param payload the data to pass to the callback + */ +GIT_EXTERN(int) git_config_backend_foreach_match( + git_config_backend *backend, + const char *regexp, + int (*fn)(const git_config_entry *, void *), + void *data); + + /** @} */ GIT_END_DECL #endif |
