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/backend/tcop/pquery.c | |
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/backend/tcop/pquery.c')
-rw-r--r-- | src/backend/tcop/pquery.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index e79c58f7025..85d05ed1b8b 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.79 2004/05/26 18:54:08 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.80 2004/06/05 19:48:08 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -347,10 +347,9 @@ PortalSetResultFormat(Portal portal, int nFormats, int16 *formats) if (portal->tupDesc == NULL) return; natts = portal->tupDesc->natts; - /* +1 avoids palloc(0) if no columns */ portal->formats = (int16 *) MemoryContextAlloc(PortalGetHeapMemory(portal), - (natts + 1) * sizeof(int16)); + natts * sizeof(int16)); if (nFormats > 1) { /* format specified for each column */ |