diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-12-13 21:19:11 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-12-13 21:19:11 +0900 |
| commit | 8253c0042147e005aecc4fdf24520d1ec2ab1642 (patch) | |
| tree | a48384374c2e022cf6205633a2a263c4d2e3d730 /git-compat-util.h | |
| parent | Git 2.36.3 (diff) | |
| parent | Git 2.35.6 (diff) | |
| download | git-8253c0042147e005aecc4fdf24520d1ec2ab1642.tar.gz git-8253c0042147e005aecc4fdf24520d1ec2ab1642.zip | |
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)) |
