]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-compat-util.h
Merge branch 'maint-2.36' into maint-2.37
[thirdparty/git.git] / git-compat-util.h
index 6aee4d92e710f694dc43d34568073d343b6fbe60..fdb24fcd2f357c28626502d0c776c20f32e82e65 100644 (file)
@@ -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