diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-03 20:50:11 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-03 20:50:11 +0100 |
commit | 4cf52fc0bc3b80c0ef6c58c5db4413ebdafe661c (patch) | |
tree | 676b26b024117cf656080a011e3d17b8fb6889af /lib/malloca.h | |
parent | 1ecbfbb92248e67b564f5b144c4671ccaa86ee2f (diff) | |
parent | 44ff3127b1e57b703c2a73a24f7ab38e4aad8ae4 (diff) |
Merge branch 'release/0.9.8-1'0.9.8-1
Diffstat (limited to 'lib/malloca.h')
-rw-r--r-- | lib/malloca.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/malloca.h b/lib/malloca.h index 55eddea..a33907a 100644 --- a/lib/malloca.h +++ b/lib/malloca.h @@ -1,5 +1,5 @@ /* Safe automatic memory allocation. - Copyright (C) 2003-2007, 2009-2016 Free Software Foundation, Inc. + Copyright (C) 2003-2007, 2009-2017 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or @@ -22,7 +22,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. */ + along with this program; if not, see <https://www.gnu.org/licenses/>. */ #ifndef _MALLOCA_H #define _MALLOCA_H @@ -30,6 +30,9 @@ #include <alloca.h> #include <stddef.h> #include <stdlib.h> +#include <stdint.h> + +#include "xalloc-oversized.h" #ifdef __cplusplus @@ -82,15 +85,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 |