summaryrefslogtreecommitdiff
path: root/lib/malloca.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-07-08 23:15:22 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-07-08 23:15:22 +0200
commit853c9cf3718db7c9f6d723e45031016231e1cbd1 (patch)
treee6a5cafe819de3d14665da32bfd87259b089ec02 /lib/malloca.h
parent7b350538dddb27a4513158cb6b6405b85f175ad1 (diff)
parent10bd216b0099d2ae8cb22c664fb725165096f95c (diff)
Merge branch 'release/debian/0.9.10-1'debian/0.9.10-1
Diffstat (limited to 'lib/malloca.h')
-rw-r--r--lib/malloca.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/malloca.h b/lib/malloca.h
index a33907a..8e47c16 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -1,5 +1,5 @@
/* Safe automatic memory allocation.
- Copyright (C) 2003-2007, 2009-2017 Free Software Foundation, Inc.
+ Copyright (C) 2003-2007, 2009-2018 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2003.
This program is free software: you can redistribute it and/or
@@ -65,8 +65,10 @@ extern "C" {
the function returns. Upon failure, it returns NULL. */
#if HAVE_ALLOCA
# define malloca(N) \
- ((N) < 4032 - sa_increment \
- ? (void *) ((char *) alloca ((N) + sa_increment) + sa_increment) \
+ ((N) < 4032 - (2 * sa_alignment_max - 1) \
+ ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \
+ + (2 * sa_alignment_max - 1)) \
+ & ~(uintptr_t)(2 * sa_alignment_max - 1)) \
: mmalloca (N))
#else
# define malloca(N) \
@@ -128,10 +130,7 @@ enum
| (sa_alignment_longlong - 1)
#endif
| (sa_alignment_longdouble - 1)
- ) + 1,
-/* The increment that guarantees room for a magic word must be >= sizeof (int)
- and a multiple of sa_alignment_max. */
- sa_increment = ((sizeof (int) + sa_alignment_max - 1) / sa_alignment_max) * sa_alignment_max
+ ) + 1
};
#endif /* _MALLOCA_H */