]> git.ipfire.org Git - thirdparty/git.git/blobdiff - kwset.c
Merge branch 'sr/gpg-interface-stop-at-the-end'
[thirdparty/git.git] / kwset.c
diff --git a/kwset.c b/kwset.c
index 090ffcafa2bd0eeff8bbc08ea15867fe8f5b7890..fc439e0667f137f3449635a37a32f8418d5041f0 100644 (file)
--- a/kwset.c
+++ b/kwset.c
 #include "compat/obstack.h"
 
 #define NCHAR (UCHAR_MAX + 1)
-#define obstack_chunk_alloc xmalloc
+/* adapter for `xmalloc()`, which takes `size_t`, not `long` */
+static void *obstack_chunk_alloc(long size)
+{
+       if (size < 0)
+               BUG("Cannot allocate a negative amount: %ld", size);
+       return xmalloc(size);
+}
 #define obstack_chunk_free free
 
 #define U(c) ((unsigned char) (c))