diff options
| author | Mattias Andrée <maandree@kth.se> | 2016-04-27 17:26:41 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@kth.se> | 2016-04-27 17:26:44 +0200 |
| commit | 5e29d29416b568f380a2ab753e3e77e96af4b094 (patch) | |
| tree | 7e89a8d4f064c36c9dd5ec34bf963b6e60d0b4f4 /src/internals.h | |
| parent | Add option UNSAFE which disables all internal error checks (diff) | |
| download | libzahl-5e29d29416b568f380a2ab753e3e77e96af4b094.tar.gz libzahl-5e29d29416b568f380a2ab753e3e77e96af4b094.tar.bz2 libzahl-5e29d29416b568f380a2ab753e3e77e96af4b094.tar.xz | |
Error-check implies unlikely branching
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/internals.h')
| -rw-r--r-- | src/internals.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/internals.h b/src/internals.h index c59b792..b055dbd 100644 --- a/src/internals.h +++ b/src/internals.h @@ -100,7 +100,7 @@ extern void *libzahl_temp_allocation; #if defined(UNSAFE) # define check(expr) 0 #else -# define check(expr) (expr) +# define check(expr) unlikely(expr) #endif #define SET_SIGNUM(a, signum) ZAHL_SET_SIGNUM(a, signum) @@ -337,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 (check(unlikely(!libzahl_temp_stack))) { + if (check(!libzahl_temp_stack)) { libzahl_temp_stack = old; libzahl_memfailure(); } |
