Repository: qpid-dispatch Updated Branches: refs/heads/master 6be6e4610 -> 5b09760d0
DISPATCH-511 - Fixed issue with posix_memalign's return value being ignored. Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/5b09760d Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/5b09760d Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/5b09760d Branch: refs/heads/master Commit: 5b09760d0d3637978ca3770c677e640837076727 Parents: 6be6e46 Author: Ted Ross <tr...@redhat.com> Authored: Tue Sep 20 10:36:00 2016 -0400 Committer: Ted Ross <tr...@redhat.com> Committed: Tue Sep 20 10:36:00 2016 -0400 ---------------------------------------------------------------------- include/qpid/dispatch/ctools.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/5b09760d/include/qpid/dispatch/ctools.h ---------------------------------------------------------------------- diff --git a/include/qpid/dispatch/ctools.h b/include/qpid/dispatch/ctools.h index 6c4afec..863033b 100644 --- a/include/qpid/dispatch/ctools.h +++ b/include/qpid/dispatch/ctools.h @@ -36,8 +36,15 @@ // If available, use aligned_alloc for cache-line-aligned allocations. Otherwise // fall back to plain malloc. // -#define NEW_CACHE_ALIGNED(t,p) posix_memalign((void*) &(p), 64, (sizeof(t) + (sizeof(t) % 64 ? 64 - (sizeof(t) % 64) : 0))) -#define ALLOC_CACHE_ALIGNED(s,p) posix_memalign((void*) &(p), 64, (s + (s % 64 ? 64 - (s % 64) : 0))) +#define NEW_CACHE_ALIGNED(t,p) \ +do { \ + if (posix_memalign((void*) &(p), 64, (sizeof(t) + (sizeof(t) % 64 ? 64 - (sizeof(t) % 64) : 0))) != 0) (p) = 0; \ +} while (0) + +#define ALLOC_CACHE_ALIGNED(s,p) \ +do { \ + if (posix_memalign((void*) &(p), 64, (s + (s % 64 ? 64 - (s % 64) : 0))) != 0) (p) = 0; \ +} while (0) #define ZERO(p) memset(p, 0, sizeof(*p)) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org