Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2f899e7

Browse files
committed
Suppress compiler warning in slab.c.
Compilers that don't realize that elog(ERROR) doesn't return complained that SlabRealloc() failed to return a value. While at it, fix the rather muddled header comment for the function. Per buildfarm.
1 parent f379121 commit 2f899e7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/backend/utils/mmgr/slab.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,14 +547,14 @@ SlabFree(MemoryContext context, void *pointer)
547547

548548
/*
549549
* SlabRealloc
550-
* As Slab is designed for allocating equally-sized chunks of memory, it
551-
* can't really do an actual realloc.
550+
* Change the allocated size of a chunk.
552551
*
553-
* We try to be gentle and allow calls with exactly the same size as in that
554-
* case we can simply return the same chunk. When the size differs, we fail
555-
* with assert failure or return NULL.
552+
* As Slab is designed for allocating equally-sized chunks of memory, it can't
553+
* do an actual chunk size change. We try to be gentle and allow calls with
554+
* exactly the same size, as in that case we can simply return the same
555+
* chunk. When the size differs, we throw an error.
556556
*
557-
* We might be even support cases with (size < chunkSize). That however seems
557+
* We could also allow requests with size < chunkSize. That however seems
558558
* rather pointless - Slab is meant for chunks of constant size, and moreover
559559
* realloc is usually used to enlarge the chunk.
560560
*/
@@ -570,6 +570,7 @@ SlabRealloc(MemoryContext context, void *pointer, Size size)
570570
return pointer;
571571

572572
elog(ERROR, "slab allocator does not support realloc()");
573+
return NULL; /* keep compiler quiet */
573574
}
574575

575576
/*

0 commit comments

Comments
 (0)