return ret;
}
+unsigned int git_config_uint(const char *name, const char *value,
+ const struct key_value_info *kvi)
+{
+ unsigned int ret;
+ if (!git_parse_uint(value, &ret))
+ die_bad_number(name, value, kvi);
+ return ret;
+}
+
int64_t git_config_int64(const char *name, const char *value,
const struct key_value_info *kvi)
{
return 1;
}
+int git_configset_get_uint(struct config_set *set, const char *key, unsigned int *dest)
+{
+ const char *value;
+ struct key_value_info kvi;
+
+ if (!git_configset_get_value(set, key, &value, &kvi)) {
+ *dest = git_config_uint(key, value, &kvi);
+ return 0;
+ } else
+ return 1;
+}
+
int git_configset_get_ulong(struct config_set *set, const char *key, unsigned long *dest)
{
const char *value;
return git_configset_get_int(repo->config, key, dest);
}
+int repo_config_get_uint(struct repository *repo,
+ const char *key, unsigned int *dest)
+{
+ git_config_check_init(repo);
+ return git_configset_get_uint(repo->config, key, dest);
+}
+
int repo_config_get_ulong(struct repository *repo,
const char *key, unsigned long *dest)
{
int64_t git_config_int64(const char *, const char *,
const struct key_value_info *);
+/**
+ * Identical to `git_config_int`, but for unsigned ints.
+ */
+unsigned int git_config_uint(const char *, const char *,
+ const struct key_value_info *);
+
/**
* Identical to `git_config_int`, but for unsigned longs.
*/
int git_configset_get_string(struct config_set *cs, const char *key, char **dest);
int git_configset_get_int(struct config_set *cs, const char *key, int *dest);
+int git_configset_get_uint(struct config_set *cs, const char *key, unsigned int *dest);
int git_configset_get_ulong(struct config_set *cs, const char *key, unsigned long *dest);
int git_configset_get_bool(struct config_set *cs, const char *key, int *dest);
int git_configset_get_bool_or_int(struct config_set *cs, const char *key, int *is_bool, int *dest);
*/
int repo_config_get_int(struct repository *r, const char *key, int *dest);
+/**
+ * Similar to `repo_config_get_int` but for unsigned ints.
+ */
+int repo_config_get_uint(struct repository *r,
+ const char *key, unsigned int *dest);
+
/**
* Similar to `repo_config_get_int` but for unsigned longs.
*/
return 1;
}
+int git_parse_uint(const char *value, unsigned int *ret)
+{
+ uintmax_t tmp;
+ if (!git_parse_unsigned(value, &tmp, maximum_unsigned_value_of_type(unsigned int)))
+ return 0;
+ *ret = tmp;
+ return 1;
+}
+
int git_parse_ulong(const char *value, unsigned long *ret)
{
uintmax_t tmp;
int git_parse_unsigned(const char *value, uintmax_t *ret, uintmax_t max);
int git_parse_ssize_t(const char *, ssize_t *);
int git_parse_ulong(const char *, unsigned long *);
+int git_parse_uint(const char *value, unsigned int *ret);
int git_parse_int(const char *value, int *ret);
int git_parse_int64(const char *value, int64_t *ret);
int git_parse_double(const char *value, double *ret);