Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-12-13 15:02:20 +0300
committerJunio C Hamano <gitster@pobox.com>2022-12-13 15:02:20 +0300
commit16128765d70f1375bcde3f27f51f85492b176a59 (patch)
treedd23b225efbbae95d2446dddb24822cec4a95f01 /git-compat-util.h
parentecf9b4a443ecd2c7dc759e5d18f226694bc3eced (diff)
parentb7b37a33711e64bf580ef3141878b12a36e28833 (diff)
Sync with Git 2.30.7
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 5ed0f00001..ba94d9f4e8 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -924,6 +924,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))