diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:15:22 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:15:22 +0300 |
commit | 3748b5b7f5648b007dc3743e918ce5eaf44ee6fc (patch) | |
tree | 59400d19784a6872e57a8210f9629d90fbd6c9b0 /git-compat-util.h | |
parent | be85cfc4dbef9ffa177770f8607fd4a85445565e (diff) | |
parent | 7fe9bf55b84d2610a7ac09893b25ef188f145a21 (diff) |
Merge branch 'maint-2.33' into maint-2.34
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 6cef176eb5..ed0892b3c8 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -932,6 +932,14 @@ static inline size_t st_sub(size_t a, size_t b) return a - b; } +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; +} + #ifdef HAVE_ALLOCA_H # include <alloca.h> # define xalloca(size) (alloca(size)) |