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:20:35 +0300
committerJunio C Hamano <gitster@pobox.com>2022-12-13 15:20:35 +0300
commit431f6e67e620f1b4f9acfddd356b56a3fd5c5e79 (patch)
treea8b7ed273a64477bb7e605acf611edfb866860f0 /git-compat-util.h
parent83d5e3341b69b3116675f13d2fab208a12c79e27 (diff)
parentad949b24f8d6ee4767c07794a2f01ada91b46b74 (diff)
Merge branch 'maint-2.36' into maint-2.37
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 6aee4d92e7..fdb24fcd2f 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -998,6 +998,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;
+}
+
/*
* Limit size of IO chunks, because huge chunks only cause pain. OS X
* 64-bit is buggy, returning EINVAL if len >= INT_MAX; and even in