diff options
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/attr.h | 32 | ||||
-rw-r--r-- | include/git2/config.h | 24 |
2 files changed, 28 insertions, 28 deletions
diff --git a/include/git2/attr.h b/include/git2/attr.h index 6a05496dc..28ca3bc1c 100644 --- a/include/git2/attr.h +++ b/include/git2/attr.h @@ -65,7 +65,7 @@ GIT_BEGIN_DECL #define GIT_ATTR_UNSPECIFIED(attr) (!(attr) || (attr) == git_attr__unset) /** - * GIT_ATTR_SET_TO_VALUE checks if an attribute is set to a value (as + * GIT_ATTR_HAS_VALUE checks if an attribute is set to a value (as * opposied to TRUE, FALSE or UNSPECIFIED). This would be the case if * for a file with something like: * @@ -74,7 +74,7 @@ GIT_BEGIN_DECL * Given this, looking up "eol" for `onefile.txt` will give back the * string "lf" and `GIT_ATTR_SET_TO_VALUE(attr)` will return true. */ -#define GIT_ATTR_SET_TO_VALUE(attr) \ +#define GIT_ATTR_HAS_VALUE(attr) \ ((attr) && (attr) != git_attr__unset && \ (attr) != git_attr__true && (attr) != git_attr__false) @@ -111,6 +111,10 @@ GIT_EXTERN(const char *) git_attr__unset; /** * Look up the value of one git attribute for path. * + * @param value_out Output of the value of the attribute. Use the GIT_ATTR_... + * macros to test for TRUE, FALSE, UNSPECIFIED, etc. or just + * use the string value for attributes set to a value. You + * should NOT modify or free this value. * @param repo The repository containing the path. * @param flags A combination of GIT_ATTR_CHECK... flags. * @param path The path to check for attributes. Relative paths are @@ -118,17 +122,13 @@ GIT_EXTERN(const char *) git_attr__unset; * not have to exist, but if it does not, then it will be * treated as a plain file (not a directory). * @param name The name of the attribute to look up. - * @param value Output of the value of the attribute. Use the GIT_ATTR_... - * macros to test for TRUE, FALSE, UNSPECIFIED, etc. or just - * use the string value for attributes set to a value. You - * should NOT modify or free this value. */ GIT_EXTERN(int) git_attr_get( + const char **value_out, git_repository *repo, uint32_t flags, const char *path, - const char *name, - const char **value); + const char *name); /** * Look up a list of git attributes for path. @@ -141,11 +141,16 @@ GIT_EXTERN(int) git_attr_get( * * const char *attrs[] = { "crlf", "diff", "foo" }; * const char **values[3]; - * git_attr_get_many(repo, 0, "my/fun/file.c", 3, attrs, values); + * git_attr_get_many(values, repo, 0, "my/fun/file.c", 3, attrs); * * Then you could loop through the 3 values to get the settings for * the three attributes you asked about. * + * @param values An array of num_attr entries that will have string + * pointers written into it for the values of the attributes. + * You should not modify or free the values that are written + * into this array (although of course, you should free the + * array itself if you allocated it). * @param repo The repository containing the path. * @param flags A combination of GIT_ATTR_CHECK... flags. * @param path The path inside the repo to check attributes. This @@ -153,19 +158,14 @@ GIT_EXTERN(int) git_attr_get( * it will be treated as a plain file (i.e. not a directory). * @param num_attr The number of attributes being looked up * @param names An array of num_attr strings containing attribute names. - * @param values An array of num_attr entries that will have string - * pointers written into it for the values of the attributes. - * You should not modify or free the values that are written - * into this array (although of course, you should free the - * array itself if you allocated it). */ GIT_EXTERN(int) git_attr_get_many( + const char **values_out, git_repository *repo, uint32_t flags, const char *path, size_t num_attr, - const char **names, - const char **values); + const char **names); /** * Loop over all the git attributes for a path. diff --git a/include/git2/config.h b/include/git2/config.h index acc45b018..983d7fc9a 100644 --- a/include/git2/config.h +++ b/include/git2/config.h @@ -65,7 +65,7 @@ typedef struct { * @return GIT_SUCCESS if a global configuration file has been * found. Its path will be stored in `buffer`. */ -GIT_EXTERN(int) git_config_find_global(char *global_config_path); +GIT_EXTERN(int) git_config_find_global(char *global_config_path, size_t length); /** * Locate the path to the system configuration file @@ -77,7 +77,7 @@ GIT_EXTERN(int) git_config_find_global(char *global_config_path); * @return GIT_SUCCESS if a system configuration file has been * found. Its path will be stored in `buffer`. */ -GIT_EXTERN(int) git_config_find_system(char *system_config_path); +GIT_EXTERN(int) git_config_find_system(char *system_config_path, size_t length); /** * Open the global configuration file @@ -177,22 +177,22 @@ GIT_EXTERN(void) git_config_free(git_config *cfg); /** * Get the value of an integer config variable. * + * @param out pointer to the variable where the value should be stored * @param cfg where to look for the variable * @param name the variable's name - * @param out pointer to the variable where the value should be stored * @return GIT_SUCCESS or an error code */ -GIT_EXTERN(int) git_config_get_int32(git_config *cfg, const char *name, int32_t *out); +GIT_EXTERN(int) git_config_get_int32(int32_t *out, git_config *cfg, const char *name); /** * Get the value of a long integer config variable. * + * @param out pointer to the variable where the value should be stored * @param cfg where to look for the variable * @param name the variable's name - * @param out pointer to the variable where the value should be stored * @return GIT_SUCCESS or an error code */ -GIT_EXTERN(int) git_config_get_int64(git_config *cfg, const char *name, int64_t *out); +GIT_EXTERN(int) git_config_get_int64(int64_t *out, git_config *cfg, const char *name); /** * Get the value of a boolean config variable. @@ -200,12 +200,12 @@ GIT_EXTERN(int) git_config_get_int64(git_config *cfg, const char *name, int64_t * This function uses the usual C convention of 0 being false and * anything else true. * + * @param out pointer to the variable where the value should be stored * @param cfg where to look for the variable * @param name the variable's name - * @param out pointer to the variable where the value should be stored * @return GIT_SUCCESS or an error code */ -GIT_EXTERN(int) git_config_get_bool(git_config *cfg, const char *name, int *out); +GIT_EXTERN(int) git_config_get_bool(int *out, git_config *cfg, const char *name); /** * Get the value of a string config variable. @@ -213,12 +213,12 @@ GIT_EXTERN(int) git_config_get_bool(git_config *cfg, const char *name, int *out) * The string is owned by the variable and should not be freed by the * user. * + * @param out pointer to the variable's value * @param cfg where to look for the variable * @param name the variable's name - * @param out pointer to the variable's value * @return GIT_SUCCESS or an error code */ -GIT_EXTERN(int) git_config_get_string(git_config *cfg, const char *name, const char **out); +GIT_EXTERN(int) git_config_get_string(const char **out, git_config *cfg, const char *name); /** * Get each value of a multivar. @@ -342,14 +342,14 @@ GIT_EXTERN(int) git_config_foreach( * If not a single match can be made to store in `out`, an error code will be * returned. * + * @param out place to store the result of the mapping * @param cfg config file to get the variables from * @param name name of the config variable to lookup * @param maps array of `git_cvar_map` objects specifying the possible mappings * @param map_n number of mapping objects in `maps` - * @param out place to store the result of the mapping * @return GIT_SUCCESS on success, error code otherwise */ -GIT_EXTERN(int) git_config_get_mapped(git_config *cfg, const char *name, git_cvar_map *maps, size_t map_n, int *out); +GIT_EXTERN(int) git_config_get_mapped(int *out, git_config *cfg, const char *name, git_cvar_map *maps, size_t map_n); /** @} */ GIT_END_DECL |