From: Marko Kreen Date: Tue, 7 Apr 2009 09:31:41 +0000 (+0000) Subject: Fix broken alignment in src/slab.c X-Git-Tag: pgbouncer_1_3_1_rc1~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c1a5b98641b7321cab2b7488da5be440d549d920;p=pgbouncer Fix broken alignment in src/slab.c Alignment macro was buggy, thus resulting in bad alignment. This means speed hit on x86, but may result in crashes on arches which are strict on alignment, unless the macro is pre-defined in OS headers. No problems from the field have been reported, thus maybe even the bad alignment happened to be aligned? --- diff --git a/src/slab.c b/src/slab.c index 0addea0..e62bd1d 100644 --- a/src/slab.c +++ b/src/slab.c @@ -27,7 +27,7 @@ #include "bouncer.h" -#define CUSTOM_ALIGN(x, a) (((unsigned long)(x) + (a)) & ~(a)) +#define CUSTOM_ALIGN(x, a) (((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)) #ifndef ALIGN #define ALIGN(x) CUSTOM_ALIGN(x, sizeof(long))