1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Tweak palloc/repalloc to allow zero bytes to be requested, as per recent

proposal.  Eliminate several dozen now-unnecessary hacks to avoid palloc(0).
(It's likely there are more that I didn't find.)
This commit is contained in:
Tom Lane
2004-06-05 19:48:09 +00:00
parent 24a1e20f14
commit c3a153afed
19 changed files with 113 additions and 113 deletions

View File

@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/memutils.h,v 1.54 2003/11/29 22:41:15 pgsql Exp $
* $PostgreSQL: pgsql/src/include/utils/memutils.h,v 1.55 2004/06/05 19:48:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -31,10 +31,13 @@
*
* XXX This is deliberately chosen to correspond to the limiting size
* of varlena objects under TOAST. See VARATT_MASK_SIZE in postgres.h.
*
* XXX Also, various places in aset.c assume they can compute twice an
* allocation's size without overflow, so beware of raising this.
*/
#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */
#define AllocSizeIsValid(size) (0 < (size) && (size) <= MaxAllocSize)
#define AllocSizeIsValid(size) ((Size) (size) <= MaxAllocSize)
/*
* All chunks allocated by any memory context manager are required to be