diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2018-02-03 00:47:15 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2018-02-03 00:47:15 +0100 |
commit | d6a3b8f0874f548838f28a1303b2c8a0ae3ac7df (patch) | |
tree | 9d69b01003c9b31da8bd633e34e5c2796fb83375 /lib/malloca.c | |
parent | f0dc63fc7ec039999981a4b7555f725c0aa65cc7 (diff) | |
download | gnulib-d6a3b8f0874f548838f28a1303b2c8a0ae3ac7df.tar.gz |
malloca: Add a compile-time verification.
* lib/malloca.c (small_t): Verify that it is wide enough.
* modules/malloca (Depends-on): Add verify.
Diffstat (limited to 'lib/malloca.c')
-rw-r--r-- | lib/malloca.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/malloca.c b/lib/malloca.c index c5321d17e9..c66e0c88e6 100644 --- a/lib/malloca.c +++ b/lib/malloca.c @@ -21,6 +21,8 @@ /* Specification. */ #include "malloca.h" +#include "verify.h" + /* The speed critical point in this file is freea() applied to an alloca() result: it must be fast, to match the speed of alloca(). The speed of mmalloca() and freea() in the other case are not critical, because they @@ -34,6 +36,8 @@ /* Type for holding very small pointer differences. */ typedef unsigned char small_t; +/* Verify that it is wide enough. */ +verify (2 * sa_alignment_max - 1 <= (small_t) -1); void * mmalloca (size_t n) |