From 27f3bbfad46e694fcbf2fa39cb621110d46ec95c Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Fri, 1 Apr 2016 20:09:13 +0300 Subject: [PATCH] Fixes in bloom contrib module missed during review - macroses llike (var & FLAG) are changed to ((var & FLAG) != 0) - do not copy uninitialized part of notFullPage array to page --- contrib/bloom/bloom.h | 12 ++++++++---- contrib/bloom/blvacuum.c | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/contrib/bloom/bloom.h b/contrib/bloom/bloom.h index 50bf99bf03..63095723c9 100644 --- a/contrib/bloom/bloom.h +++ b/contrib/bloom/bloom.h @@ -44,10 +44,14 @@ typedef BloomPageOpaqueData *BloomPageOpaque; /* Macros for accessing bloom page structures */ #define BloomPageGetOpaque(page) ((BloomPageOpaque) PageGetSpecialPointer(page)) #define BloomPageGetMaxOffset(page) (BloomPageGetOpaque(page)->maxoff) -#define BloomPageIsMeta(page) (BloomPageGetOpaque(page)->flags & BLOOM_META) -#define BloomPageIsDeleted(page) (BloomPageGetOpaque(page)->flags & BLOOM_DELETED) -#define BloomPageSetDeleted(page) (BloomPageGetOpaque(page)->flags |= BLOOM_DELETED) -#define BloomPageSetNonDeleted(page) (BloomPageGetOpaque(page)->flags &= ~BLOOM_DELETED) +#define BloomPageIsMeta(page) \ + ((BloomPageGetOpaque(page)->flags & BLOOM_META) != 0) +#define BloomPageIsDeleted(page) \ + ((BloomPageGetOpaque(page)->flags & BLOOM_DELETED) != 0) +#define BloomPageSetDeleted(page) \ + (BloomPageGetOpaque(page)->flags |= BLOOM_DELETED) +#define BloomPageSetNonDeleted(page) \ + (BloomPageGetOpaque(page)->flags &= ~BLOOM_DELETED) #define BloomPageGetData(page) ((BloomTuple *)PageGetContents(page)) #define BloomPageGetTuple(state, page, offset) \ ((BloomTuple *)(PageGetContents(page) \ diff --git a/contrib/bloom/blvacuum.c b/contrib/bloom/blvacuum.c index fb8d9b8a5f..d976ce5330 100644 --- a/contrib/bloom/blvacuum.c +++ b/contrib/bloom/blvacuum.c @@ -142,7 +142,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, page = GenericXLogRegister(gxlogState, buffer, false); metaData = BloomPageGetMeta(page); - memcpy(metaData->notFullPage, notFullPage, sizeof(FreeBlockNumberArray)); + memcpy(metaData->notFullPage, notFullPage, sizeof(BlockNumber) * countPage); metaData->nStart = 0; metaData->nEnd = countPage; -- 2.40.0