]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-compat-util.h
Sync with Git 2.30.7
[thirdparty/git.git] / git-compat-util.h
index 5ed0f0000116513167582830998365204c25481d..ba94d9f4e80c5c717a9a150a2ea525a31863123e 100644 (file)
@@ -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))