Files
git/parse.h
Adrian Ratiu 4c40cd5ebb config: add a repo_config_get_uint() helper
Next commits add a 'hook.jobs' config option of type 'unsigned int',
so add a helper to parse it since the API only supports int and ulong.

An alternative is to make 'hook.jobs' an 'int' or parse it as an 'int'
then cast it to unsigned, however it's better to use proper helpers for
the type. Using 'ulong' is another option which already has helpers, but
it's a bit excessive in size for just the jobs number.

Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-02-21 21:17:07 -08:00

24 lines
795 B
C

#ifndef PARSE_H
#define PARSE_H
int git_parse_signed(const char *value, intmax_t *ret, intmax_t max);
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);
/**
* Same as `git_config_bool`, except that it returns -1 on error rather
* than dying.
*/
int git_parse_maybe_bool(const char *);
int git_parse_maybe_bool_text(const char *value);
int git_env_bool(const char *, int);
unsigned long git_env_ulong(const char *, unsigned long);
#endif /* PARSE_H */