Re: [PATCH v3 2/3] config: add hashtable for config parsing & retrieval
Tanay Abhra <tanayabh@gmail.com> writes:
Show 23 quoted lines
> +Querying For Specific Variables
> +-------------------------------
> +
> +For programs wanting to query for specific variables in a non-callback
> +manner, the config API provides two functions `git_config_get_string`
> +and `git_config_get_string_multi`.They both read values from an internal
> +cache generated previously from reading the config files.
> +
> +`git_config_get_string` takes two parameters,
> +
> +- a key string in canonical flat form for which the corresponding value
> + with the highest priority (i.e. value in the repo config will be
> + preferred over value in user wide config for the same variable) will
> + be retrieved.
> +
> +- a pointer to a string which will point to the retrieved value.
> +
> +`git_config_get_string` returns 0 for success, or -1 for no value found.
> +
> +`git_config_get_string_multi` returns a `string_list` containing all the
> +values for the key passed as parameter, sorted in order of increasing
> +priority (Note: NULL values are flagged as 1, check `util` for each
> +'string_list_item` for flag value).
I think you need to add something like:
Both functions return pointers to values owned by the config cache. The
caller need not free them, but should not modify them.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/