diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:25:15 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:25:15 +0300 |
commit | 96738bb0e1e4bff68cf39ed288330d76afdbc425 (patch) | |
tree | f4c4360bb8632cecfa3afb786dfad301a487b0a0 /git-compat-util.h | |
parent | c48035d29b4e524aed3a32f0403676f0d9128863 (diff) | |
parent | 37ed7bf0f13d204ccb6b8e7e2fbcf7b3bf13e25c (diff) |
Sync with 2.38.3
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 a76d0526f7..af05077560 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1020,6 +1020,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 |