diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:19:11 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:19:11 +0300 |
commit | 8253c0042147e005aecc4fdf24520d1ec2ab1642 (patch) | |
tree | a48384374c2e022cf6205633a2a263c4d2e3d730 /git-compat-util.h | |
parent | fcdaa211e6127eeba69a121844e08aec67da2131 (diff) | |
parent | 02f498172348f7ba9dceb169305b74c7eca7a38d (diff) |
Merge branch 'maint-2.35' into maint-2.36
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 ccf06289c3..33636827d5 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -989,6 +989,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; +} + #ifdef HAVE_ALLOCA_H # include <alloca.h> # define xalloca(size) (alloca(size)) |