1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +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

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.113 2004/06/05 01:55:04 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.114 2004/06/05 19:48:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -538,9 +538,9 @@ generate_append_tlist(List *colTypes, bool flag,
* First extract typmods to use.
*
* If the inputs all agree on type and typmod of a particular column, use
* that typmod; else use -1. (+1 here in case of zero columns.)
* that typmod; else use -1.
*/
colTypmods = (int32 *) palloc(list_length(colTypes) * sizeof(int32) + 1);
colTypmods = (int32 *) palloc(list_length(colTypes) * sizeof(int32));
foreach(planl, input_plans)
{

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.173 2004/06/01 04:47:45 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.174 2004/06/05 19:48:08 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -2016,7 +2016,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
* actual substitution of the inputs. So start building expression
* with inputs substituted.
*/
usecounts = (int *) palloc0((funcform->pronargs + 1) * sizeof(int));
usecounts = (int *) palloc0(funcform->pronargs * sizeof(int));
newexpr = substitute_actual_parameters(newexpr, funcform->pronargs,
args, usecounts);