Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4f91e8c

Browse files
david-rowleypull[bot]
authored andcommitted
Fix some compiler warnings in aset.c and generation.c
This fixes a couple of unused variable warnings that could be seen whencompiling 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 GuoDiscussion:https://postgr.es/m/CAMbWs4_D-vgLEh7eO47p=73u1jWO78NWf6Qfv1FndY1kG-Q-jA@mail.gmail.com
1 parent23b833b commit4f91e8c

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

‎src/backend/utils/mmgr/aset.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,10 +1024,8 @@ AllocSetFree(void *pointer)
10241024

10251025
#ifdefMEMORY_CONTEXT_CHECKING
10261026
{
1027-
Sizechunk_size=block->endptr- (char*)pointer;
1028-
10291027
/* Test for someone scribbling on unused space in chunk */
1030-
Assert(chunk->requested_size<chunk_size);
1028+
Assert(chunk->requested_size<(block->endptr- (char*)pointer));
10311029
if (!sentinel_ok(pointer,chunk->requested_size))
10321030
elog(WARNING,"detected write past chunk end in %s %p",
10331031
set->header.name,chunk);

‎src/backend/utils/mmgr/generation.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,8 @@ GenerationFree(void *pointer)
629629
MemoryChunk*chunk=PointerGetMemoryChunk(pointer);
630630
GenerationBlock*block;
631631
GenerationContext*set;
632-
#if defined(MEMORY_CONTEXT_CHECKING)|| defined(CLOBBER_FREED_MEMORY)
632+
#if (defined(MEMORY_CONTEXT_CHECKING)&& defined(USE_ASSERT_CHECKING)) \
633+
|| defined(CLOBBER_FREED_MEMORY)
633634
Sizechunksize;
634635
#endif
635636

@@ -644,7 +645,8 @@ GenerationFree(void *pointer)
644645
if (!GenerationBlockIsValid(block))
645646
elog(ERROR,"could not find block containing chunk %p",chunk);
646647

647-
#if defined(MEMORY_CONTEXT_CHECKING)|| defined(CLOBBER_FREED_MEMORY)
648+
#if (defined(MEMORY_CONTEXT_CHECKING)&& defined(USE_ASSERT_CHECKING)) \
649+
|| defined(CLOBBER_FREED_MEMORY)
648650
chunksize=block->endptr- (char*)pointer;
649651
#endif
650652
}
@@ -659,7 +661,8 @@ GenerationFree(void *pointer)
659661
*/
660662
Assert(GenerationBlockIsValid(block));
661663

662-
#if defined(MEMORY_CONTEXT_CHECKING)|| defined(CLOBBER_FREED_MEMORY)
664+
#if (defined(MEMORY_CONTEXT_CHECKING)&& defined(USE_ASSERT_CHECKING)) \
665+
|| defined(CLOBBER_FREED_MEMORY)
663666
chunksize=MemoryChunkGetValue(chunk);
664667
#endif
665668
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp