Commit c20d71eac928fef34a89ced3cbb6502ab2763dc9

Carlos Martín Nieto 2014-03-31T10:13:40

config: document the how long the pointers are valid for

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