Commit 2f899e7d authored by Tom Lane's avatar Tom Lane

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.
parent f3791210
...@@ -547,14 +547,14 @@ SlabFree(MemoryContext context, void *pointer) ...@@ -547,14 +547,14 @@ SlabFree(MemoryContext context, void *pointer)
/* /*
* SlabRealloc * SlabRealloc
* As Slab is designed for allocating equally-sized chunks of memory, it * Change the allocated size of a chunk.
* can't really do an actual realloc.
* *
* We try to be gentle and allow calls with exactly the same size as in that * As Slab is designed for allocating equally-sized chunks of memory, it can't
* case we can simply return the same chunk. When the size differs, we fail * do an actual chunk size change. We try to be gentle and allow calls with
* with assert failure or return NULL. * exactly the same size, as in that case we can simply return the same
* chunk. When the size differs, we throw an error.
* *
* We might be even support cases with (size < chunkSize). That however seems * We could also allow requests with size < chunkSize. That however seems
* rather pointless - Slab is meant for chunks of constant size, and moreover * rather pointless - Slab is meant for chunks of constant size, and moreover
* realloc is usually used to enlarge the chunk. * realloc is usually used to enlarge the chunk.
*/ */
...@@ -570,6 +570,7 @@ SlabRealloc(MemoryContext context, void *pointer, Size size) ...@@ -570,6 +570,7 @@ SlabRealloc(MemoryContext context, void *pointer, Size size)
return pointer; return pointer;
elog(ERROR, "slab allocator does not support realloc()"); elog(ERROR, "slab allocator does not support realloc()");
return NULL; /* keep compiler quiet */
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment