mirror of
https://github.com/git/git.git
synced 2026-08-09 09:34:14 +00:00
These three are a single accounting tuple (the globals tracking cumulative cached-delta bytes, plus the helper that compares them against an incoming delta size) and are latently 32-bit on Windows where `unsigned long` != `size_t`: a pack with many large cached deltas could wrap silently. The widening is internally consistent on its own: the additions and subtractions against delta_cache_size already come from `size_t` sources (`DELTA_SIZE()` returns `size_t`), and `delta_cacheable()`'s sole caller in `try_delta()` still passes `unsigned long`, which promotes. Prerequisite for dropping `try_delta()`'s `cast_size_t_to_ulong()` shims, which becomes possible once 1create_delta()` and `diff_delta()` are widened in a later commit. Note: since `max_delta_cache_size` changes data type to `size_t`, a pair of new helpers is introduced to parse config values of that type, too. Assisted-by: Opus 4.7 Helped-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
25 lines
841 B
C
25 lines
841 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_size_t(const char *, size_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 */
|