diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-04-27 17:19:53 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-04-27 17:19:53 +0200 |
| commit | e746f06265981fd17bc656ca59e0ed82f6cea84d (patch) | |
| tree | 9161d4428b889f7aa4375988c4fdc29e1ab02ee2 /src/internals.h | |
| parent | Minor word fix in STATUS (diff) | |
| download | libzahl-e746f06265981fd17bc656ca59e0ed82f6cea84d.tar.gz libzahl-e746f06265981fd17bc656ca59e0ed82f6cea84d.tar.bz2 libzahl-e746f06265981fd17bc656ca59e0ed82f6cea84d.tar.xz | |
Add option UNSAFE which disables all internal error checks
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/internals.h')
| -rw-r--r-- | src/internals.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/internals.h b/src/internals.h index 2459f04..c59b792 100644 --- a/src/internals.h +++ b/src/internals.h @@ -97,6 +97,12 @@ extern void *libzahl_temp_allocation; #define likely(expr) ZAHL_LIKELY(expr) #define unlikely(expr) ZAHL_UNLIKELY(expr) +#if defined(UNSAFE) +# define check(expr) 0 +#else +# define check(expr) (expr) +#endif + #define SET_SIGNUM(a, signum) ZAHL_SET_SIGNUM(a, signum) #define SET(a, b) ZAHL_SET(a, b) #define ENSURE_SIZE(a, n) do { if ((a)->alloced < (n)) libzahl_realloc(a, (n)); } while (0) @@ -331,7 +337,7 @@ zinit_temp(z_t a) size_t n = (size_t)(libzahl_temp_stack_end - libzahl_temp_stack); void* old = libzahl_temp_stack; libzahl_temp_stack = realloc(old, 2 * n * sizeof(*libzahl_temp_stack)); - if (unlikely(!libzahl_temp_stack)) { + if (check(unlikely(!libzahl_temp_stack))) { libzahl_temp_stack = old; libzahl_memfailure(); } |
