diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-13 21:23:36 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-13 21:23:36 +0900 |
commit | fea9f607a88dc43e479c7c9105663f28b8a0deb9 (patch) | |
tree | 59d27e9fbd4f3a182861b3530b17e0c8d7c12b18 /git-compat-util.h | |
parent | 8706a59933d09354c5e3eb09a543453655a97183 (diff) | |
parent | e43ac5f23d3231f6433558931296d555592e978a (diff) | |
download | git-fea9f607a88dc43e479c7c9105663f28b8a0deb9.tar.gz |
Sync with Git 2.37.5
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index 045b47f83a..9bfd7ce76d 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1015,6 +1015,14 @@ static inline unsigned long cast_size_t_to_ulong(size_t a) return (unsigned long)a; } +static inline int cast_size_t_to_int(size_t a) +{ + if (a > INT_MAX) + die("number too large to represent as int on this platform: %"PRIuMAX, + (uintmax_t)a); + return (int)a; +} + /* * Limit size of IO chunks, because huge chunks only cause pain. OS X * 64-bit is buggy, returning EINVAL if len >= INT_MAX; and even in |