config: document the how long the pointers are valid for
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/include/git2/config.h b/include/git2/config.h
index 86c4012..21a5825 100644
--- a/include/git2/config.h
+++ b/include/git2/config.h
@@ -233,6 +233,9 @@ GIT_EXTERN(int) git_config_open_global(git_config **out, git_config *config);
* allows you to look into a consistent view of the configuration for
* looking up complex values (e.g. a remote, submodule).
*
+ * The string returned when querying such a config object is valid
+ * until it is freed.
+ *
* @param out pointer in which to store the snapshot config object
* @param config configuration to snapshot
* @return 0 or an error code
@@ -325,7 +328,8 @@ GIT_EXTERN(int) git_config_get_bool(int *out, const git_config *cfg, const char
* Get the value of a string config variable.
*
* The string is owned by the variable and should not be freed by the
- * user.
+ * user. The pointer will be valid until the next operation on this
+ * config object.
*
* All config files will be looked into, in the order of their
* defined level. A higher level means a higher priority. The
@@ -366,6 +370,9 @@ GIT_EXTERN(int) git_config_multivar_iterator_new(git_config_iterator **out, cons
/**
* Return the current entry and advance the iterator
*
+ * The pointers returned by this function are valid until the iterator
+ * is freed.
+ *
* @param entry pointer to store the entry
* @param iter the iterator
* @return 0 or an error code. GIT_ITEROVER if the iteration has completed
@@ -464,6 +471,9 @@ GIT_EXTERN(int) git_config_delete_multivar(git_config *cfg, const char *name, co
* If the callback returns a non-zero value, the function stops iterating
* and returns that value to the caller.
*
+ * The pointers passed to the callback are only valid as long as the
+ * iteration is ongoing.
+ *
* @param cfg where to get the variables from
* @param callback the function to call on each variable
* @param payload the data to pass to the callback
@@ -504,6 +514,9 @@ GIT_EXTERN(int) git_config_iterator_glob_new(git_config_iterator **out, const gi
* regular expression that filters which config keys are passed to the
* callback.
*
+ * The pointers passed to the callback are only valid as long as the
+ * iteration is ongoing.
+ *
* @param cfg where to get the variables from
* @param regexp regular expression to match against config names
* @param callback the function to call on each variable