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>2023-01-16 23:11:58 +0300
committerJunio C Hamano <gitster@pobox.com>2023-01-16 23:11:58 +0300
commit508386c6c5857b4faa2c3e491f422c98cc69ae76 (patch)
treea9cb78feca76b78a66d651e533a63646af4b1f17 /git-compat-util.h
parent262c45b6a17d971cd440c6cd2fdeff1e0d081e47 (diff)
parent01443f01b7c6a3c6ef03268b649b119027743115 (diff)
Sync with 2.39.1
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 76e4b11131..7f84430d0e 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -1022,6 +1022,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