diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:09:40 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:09:40 +0300 |
commit | 8a755eddf5bf256613bc584f32cd44401a25897c (patch) | |
tree | b5d92c6283e1b889bf50ff7056dfb1196e9277ac /git-compat-util.h | |
parent | af778cd9be6307e34f9f900fd42eb826c65b32da (diff) | |
parent | 82689d5e5d3f41da2ab1fbf9fbe7aacfd6da74c1 (diff) |
Sync with Git 2.31.6
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 f685a4f0fa..955c45db98 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -929,6 +929,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)) |