1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Fix some compiler warnings in aset.c and generation.c

This fixes a couple of unused variable warnings that could be seen when
compiling with MEMORY_CONTEXT_CHECKING but not USE_ASSERT_CHECKING.
Defining MEMORY_CONTEXT_CHECKING without asserts is a little unusual,
however, we shouldn't be producing any warnings from such a build.

Author: Richard Guo
Discussion: https://postgr.es/m/CAMbWs4_D-vgLEh7eO47p=73u1jWO78NWf6Qfv1FndY1kG-Q-jA@mail.gmail.com
This commit is contained in:
David Rowley
2023-01-05 12:56:17 +13:00
parent eb5ad4ff05
commit b82557ecc2
2 changed files with 7 additions and 6 deletions

View File

@@ -1024,10 +1024,8 @@ AllocSetFree(void *pointer)
#ifdef MEMORY_CONTEXT_CHECKING
{
Size chunk_size = block->endptr - (char *) pointer;
/* Test for someone scribbling on unused space in chunk */
Assert(chunk->requested_size < chunk_size);
Assert(chunk->requested_size < (block->endptr - (char *) pointer));
if (!sentinel_ok(pointer, chunk->requested_size))
elog(WARNING, "detected write past chunk end in %s %p",
set->header.name, chunk);