From c3a153afed84e29dac664bdc6123724a9e3a906f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 5 Jun 2004 19:48:09 +0000 Subject: 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.) --- src/include/utils/memutils.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/include/utils/memutils.h') 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 -- cgit v1.2.3