summaryrefslogtreecommitdiff
path: root/include/git2/config.h
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-06-29 15:09:21 +0200
committerVicent Marti <tanoku@gmail.com>2011-06-29 15:09:21 +0200
commitcfef5fb779ceba60cdd04f323b88373181c0fa8d (patch)
tree7561cc48ef1928ed7e6836454a9fba3ce753a47d /include/git2/config.h
parent7376ad99275fee606f298e56ac2652c203f8ebe2 (diff)
downloadlibgit2-cfef5fb779ceba60cdd04f323b88373181c0fa8d.tar.gz
config: `foreach` now returns variable values too
Diffstat (limited to 'include/git2/config.h')
-rw-r--r--include/git2/config.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/include/git2/config.h b/include/git2/config.h
index feac112b..05ff3090 100644
--- a/include/git2/config.h
+++ b/include/git2/config.h
@@ -48,7 +48,7 @@ struct git_config_file {
int (*open)(struct git_config_file *);
int (*get)(struct git_config_file *, const char *key, const char **value);
int (*set)(struct git_config_file *, const char *key, const char *value);
- int (*foreach)(struct git_config_file *, int (*fn)(const char *, void *), void *data);
+ int (*foreach)(struct git_config_file *, int (*fn)(const char *, const char *, void *), void *data);
void (*free)(struct git_config_file *);
};
@@ -254,19 +254,22 @@ GIT_EXTERN(int) git_config_set_bool(git_config *cfg, const char *name, int value
GIT_EXTERN(int) git_config_set_string(git_config *cfg, const char *name, const char *value);
/**
- * Perform an operation on each config variable.
+ * Perform an operation on each config variable
*
- * The callback is passed a pointer to a config variable name and the
- * data pointer passed to this function. As soon as one of the
- * callback functions returns something other than 0, this function
- * returns that value.
+ * The callback receives the normalized name and value of each variable
+ * in the config backend, and the data pointer passed to this function.
+ * As soon as one of the callback functions returns something other than 0,
+ * this function returns that value.
*
* @param cfg where to get the variables from
* @param callback the function to call on each variable
* @param data the data to pass to the callback
* @return GIT_SUCCESS or the return value of the callback which didn't return 0
*/
-GIT_EXTERN(int) git_config_foreach(git_config *cfg, int (*callback)(const char *, void *data), void *data);
+GIT_EXTERN(int) git_config_foreach(
+ git_config *cfg,
+ int (*callback)(const char *var_name, const char *value, void *payload),
+ void *payload);
/** @} */
GIT_END_DECL