diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-05 19:48:09 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-06-05 19:48:09 +0000 |
commit | c3a153afed84e29dac664bdc6123724a9e3a906f (patch) | |
tree | 8249c3dd76ddc9874656ec36f763227327c0a70e /src/include/utils/memutils.h | |
parent | 24a1e20f146f3b4b88f0f5189a7631c511796310 (diff) | |
download | postgresql-c3a153afed84e29dac664bdc6123724a9e3a906f.tar.gz postgresql-c3a153afed84e29dac664bdc6123724a9e3a906f.zip |
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.)
Diffstat (limited to 'src/include/utils/memutils.h')
-rw-r--r-- | src/include/utils/memutils.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h index 29e3878c998..7865859c062 100644 --- a/src/include/utils/memutils.h +++ b/src/include/utils/memutils.h @@ -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 |