Commit c20d71ea by Carlos Martín Nieto

config: document the how long the pointers are valid for

parent 523032cd
...@@ -233,6 +233,9 @@ GIT_EXTERN(int) git_config_open_global(git_config **out, git_config *config); ...@@ -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 * allows you to look into a consistent view of the configuration for
* looking up complex values (e.g. a remote, submodule). * 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 out pointer in which to store the snapshot config object
* @param config configuration to snapshot * @param config configuration to snapshot
* @return 0 or an error code * @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 ...@@ -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. * Get the value of a string config variable.
* *
* The string is owned by the variable and should not be freed by the * 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 * All config files will be looked into, in the order of their
* defined level. A higher level means a higher priority. The * 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 ...@@ -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 * 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 entry pointer to store the entry
* @param iter the iterator * @param iter the iterator
* @return 0 or an error code. GIT_ITEROVER if the iteration has completed * @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 ...@@ -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 * If the callback returns a non-zero value, the function stops iterating
* and returns that value to the caller. * 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 cfg where to get the variables from
* @param callback the function to call on each variable * @param callback the function to call on each variable
* @param payload the data to pass to the callback * @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 ...@@ -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 * regular expression that filters which config keys are passed to the
* callback. * 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 cfg where to get the variables from
* @param regexp regular expression to match against config names * @param regexp regular expression to match against config names
* @param callback the function to call on each variable * @param callback the function to call on each variable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment