summaryrefslogtreecommitdiff
path: root/kwset.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-07-09 15:25:41 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-07-09 15:25:41 -0700
commit7785f9ba030674671eb78ccfd2358f6903b632fb (patch)
tree53fbdf7f2d933eba81f87f3018a50d135c172f23 /kwset.c
parentMerge branch 'dl/includeif-onbranch' (diff)
parentconfig: avoid calling `labs()` on too-large data type (diff)
downloadtgif-7785f9ba030674671eb78ccfd2358f6903b632fb.tar.xz
Merge branch 'js/gcc-8-and-9'
Code clean-up for new compilers. * js/gcc-8-and-9: config: avoid calling `labs()` on too-large data type winansi: simplify loading the GetCurrentConsoleFontEx() function kwset: allow building with GCC 8 poll (mingw): allow compiling with GCC 8 and DEVELOPER=1
Diffstat (limited to 'kwset.c')
-rw-r--r--kwset.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kwset.c b/kwset.c
index 090ffcafa2..fc439e0667 100644
--- a/kwset.c
+++ b/kwset.c
@@ -38,7 +38,13 @@
#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))