diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-03-07 05:54:53 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-03-07 05:54:53 +0100 |
commit | 76ef1d8e3249e82a6965fd17157bee00a7857ff3 (patch) | |
tree | 7d3d34b059039faf525d1e95bbdc1945a9fa103c /lib/malloca.h | |
parent | 0cb66c451a1a4e717878b8296b79c8d7cfd38b30 (diff) | |
parent | 93e8e16be294d19261c7378dd2e46d3f35f06926 (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'lib/malloca.h')
-rw-r--r-- | lib/malloca.h | 13 |
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 */ |