Commit 783474cf authored by Niels Möller's avatar Niels Möller
Browse files

(TMP_ALLOC etc): Include <alloca.h> if

available.

Rev: src/nettle/nettle-internal.h:1.5
parent ccc7508e
...@@ -35,13 +35,13 @@ ...@@ -35,13 +35,13 @@
* fix maximum size, and abort if we ever need anything larger. */ * fix maximum size, and abort if we ever need anything larger. */
#if HAVE_ALLOCA #if HAVE_ALLOCA
# define TMP_DECL(name, type, max) \ # if HAVE_ALLOCA_H
type *name # include <alloca.h>
# define TMP_ALLOC(name, size) \ # endif
(name = alloca(sizeof (*name) * size)) # define TMP_DECL(name, type, max) type *name
# define TMP_ALLOC(name, size) (name = alloca(sizeof (*name) * size))
#else /* !HAVE_ALLOCA */ #else /* !HAVE_ALLOCA */
# define TMP_DECL(name, type, max) \ # define TMP_DECL(name, type, max) type name[max]
type name[max]
# define TMP_ALLOC(name, size) \ # define TMP_ALLOC(name, size) \
do { if (size > (sizeof(name) / sizeof(name[0]))) abort(); } while (0) do { if (size > (sizeof(name) / sizeof(name[0]))) abort(); } while (0)
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment