From 421d95b3eae80b18666761c3d97d2f6f3a2994b8 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Thu, 29 Jul 2010 16:28:34 -0700 Subject: [PATCH] Remove declarations in VERIFY3_IMPL to save stack This has a minor impact on stack usage of individual functions, but the VERIFY macros are used so frequently that their overhead may add up. This macro declared two new local variables to cast its argument types. Doing the typecast inline eliminates the need for these variables. Signed-off-by: Brian Behlendorf --- lib/libspl/include/assert.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/libspl/include/assert.h b/lib/libspl/include/assert.h index 7f145b89a3..ace72fb35b 100644 --- a/lib/libspl/include/assert.h +++ b/lib/libspl/include/assert.h @@ -65,13 +65,11 @@ extern void __assert(const char *, const char *, int); /* BEGIN CSTYLED */ #define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE) do { \ - const TYPE __left = (TYPE)(LEFT); \ - const TYPE __right = (TYPE)(RIGHT); \ - if (!(__left OP __right)) { \ + if (!((TYPE)(LEFT) OP (TYPE)(RIGHT))) { \ char *__buf = alloca(256); \ (void) snprintf(__buf, 256, "%s %s %s (0x%llx %s 0x%llx)", \ #LEFT, #OP, #RIGHT, \ - (u_longlong_t)__left, #OP, (u_longlong_t)__right); \ + (u_longlong_t)(LEFT), #OP, (u_longlong_t)(RIGHT)); \ __assert(__buf, __FILE__, __LINE__); \ } \ } while (0)