summaryrefslogtreecommitdiff
path: root/lib/malloca.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/malloca.h')
-rw-r--r--lib/malloca.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/malloca.h b/lib/malloca.h
index aeea648..7996d1b 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -1,7 +1,5 @@
-/* -*- buffer-read-only: t -*- vi: set ro: */
-/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
/* Safe automatic memory allocation.
- Copyright (C) 2003-2007, 2009-2012 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software; you can redistribute it and/or modify
@@ -23,6 +21,9 @@
#include <alloca.h>
#include <stddef.h>
#include <stdlib.h>
+#include <stdint.h>
+
+#include "xalloc-oversized.h"
#ifdef __cplusplus
@@ -75,15 +76,7 @@ extern void freea (void *p);
It allocates an array of N objects, each with S bytes of memory,
on the stack. S must be positive and N must be nonnegative.
The array must be freed using freea() before the function returns. */
-#if 1
-/* Cf. the definition of xalloc_oversized. */
-# define nmalloca(n, s) \
- ((n) > (size_t) (sizeof (ptrdiff_t) <= sizeof (size_t) ? -1 : -2) / (s) \
- ? NULL \
- : malloca ((n) * (s)))
-#else
-extern void * nmalloca (size_t n, size_t s);
-#endif
+#define nmalloca(n, s) (xalloc_oversized (n, s) ? NULL : malloca ((n) * (s)))
#ifdef __cplusplus
@@ -94,7 +87,7 @@ extern void * nmalloca (size_t n, size_t s);
/* ------------------- Auxiliary, non-public definitions ------------------- */
/* Determine the alignment of a type at compile time. */
-#if defined __GNUC__
+#if defined __GNUC__ || defined __IBM__ALIGNOF__
# define sa_alignof __alignof__
#elif defined __cplusplus
template <class type> struct sa_alignof_helper { char __slot1; type __slot2; };