diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:13:11 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-12-13 15:13:11 +0300 |
commit | 5f22dcc02df6e69145489c8bec6872e9452688b8 (patch) | |
tree | 3ac971cab6328eb6d415796f80659f634630cde2 /git-compat-util.h | |
parent | 7800e1dccf622ba8d490b4c1c92af734be6242ff (diff) | |
parent | d96ea538e8dd0fcf381089a3b09c0a9af3617351 (diff) |
Sync with Git 2.32.5
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 a382f3666d..36e582099c 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)) |