summaryrefslogtreecommitdiff
path: root/mallocx.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-05-03 11:16:32 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-05-03 11:16:32 +0300
commit12db6dad9f8a0d8e76f00fe88e135da012d08bc4 (patch)
treea5b50516cc4357d892295f9107e429441b7a57c1 /mallocx.c
parent2b75998376e24e5ca3967bab2d109cb00e0eb2f5 (diff)
downloadbdwgc-12db6dad9f8a0d8e76f00fe88e135da012d08bc4.tar.gz
Workaround 'opposite expression on both sides of &' cppcheck style warning
* mallocx.c (GC_posix_memalign): Replace (align-1)&align with align_minus_one&align where align_minus_one local variable is set to align-1.
Diffstat (limited to 'mallocx.c')
-rw-r--r--mallocx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mallocx.c b/mallocx.c
index 390661ba..7626c720 100644
--- a/mallocx.c
+++ b/mallocx.c
@@ -533,7 +533,8 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_memalign(size_t align, size_t lb)
GC_API int GC_CALL GC_posix_memalign(void **memptr, size_t align, size_t lb)
{
/* Check alignment properly. */
- if (((align - 1) & align) != 0 || align < sizeof(void *)) {
+ size_t align_minus_one = align - 1; /* to workaround a cppcheck warning */
+ if (align < sizeof(void *) || (align_minus_one & align) != 0) {
# ifdef MSWINCE
return ERROR_INVALID_PARAMETER;
# else