1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Add new palloc0 call as merge of palloc and MemSet(0).

This commit is contained in:
Bruce Momjian
2002-11-13 00:39:48 +00:00
parent aaa3a0caa6
commit 9b12ab6d5d
37 changed files with 107 additions and 210 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.62 2002/11/11 03:02:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.63 2002/11/13 00:39:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -121,9 +121,8 @@ index_formtuple(TupleDesc tupleDescriptor,
#endif
size = MAXALIGN(size); /* be conservative */
tp = (char *) palloc(size);
tp = (char *) palloc0(size);
tuple = (IndexTuple) tp;
MemSet(tp, 0, size);
DataFill((char *) tp + hoff,
tupleDescriptor,

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.93 2002/11/11 03:02:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.94 2002/11/13 00:39:46 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -60,8 +60,7 @@ CreateTemplateTupleDesc(int natts, bool hasoid)
{
uint32 size = natts * sizeof(Form_pg_attribute);
desc->attrs = (Form_pg_attribute *) palloc(size);
MemSet(desc->attrs, 0, size);
desc->attrs = (Form_pg_attribute *) palloc0(size);
}
else
desc->attrs = NULL;

View File

@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.98 2002/11/11 03:02:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.99 2002/11/13 00:39:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1316,10 +1316,8 @@ gistSplit(Relation r,
*/
if (r->rd_att->natts > 1)
{
v.spl_idgrp = (int *) palloc(sizeof(int) * (*len + 1));
MemSet((void *) v.spl_idgrp, 0, sizeof(int) * (*len + 1));
v.spl_grpflag = (char *) palloc(sizeof(char) * (*len + 1));
MemSet((void *) v.spl_grpflag, 0, sizeof(char) * (*len + 1));
v.spl_idgrp = (int *) palloc0(sizeof(int) * (*len + 1));
v.spl_grpflag = (char *) palloc0(sizeof(char) * (*len + 1));
v.spl_ngrp = (int *) palloc(sizeof(int) * (*len + 1));
MaxGrpId = gistfindgroup(giststate, (GISTENTRY *) VARDATA(entryvec), &v);

View File

@@ -35,7 +35,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.68 2002/11/11 03:02:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.69 2002/11/13 00:39:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -111,9 +111,7 @@ static void _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2);
BTSpool *
_bt_spoolinit(Relation index, bool isunique)
{
BTSpool *btspool = (BTSpool *) palloc(sizeof(BTSpool));
MemSet((char *) btspool, 0, sizeof(BTSpool));
BTSpool *btspool = (BTSpool *) palloc0(sizeof(BTSpool));
btspool->index = index;
btspool->isunique = isunique;
@@ -207,9 +205,7 @@ _bt_blnewpage(Relation index, Buffer *buf, Page *page, int flags)
static BTPageState *
_bt_pagestate(Relation index, int flags, int level)
{
BTPageState *state = (BTPageState *) palloc(sizeof(BTPageState));
MemSet((char *) state, 0, sizeof(BTPageState));
BTPageState *state = (BTPageState *) palloc0(sizeof(BTPageState));
/* create initial page */
_bt_blnewpage(index, &(state->btps_buf), &(state->btps_page), flags);

View File

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.35 2002/11/11 03:02:18 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.36 2002/11/13 00:39:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -103,9 +103,7 @@ rt_poly_union(PG_FUNCTION_ARGS)
POLYGON *b = PG_GETARG_POLYGON_P(1);
POLYGON *p;
p = (POLYGON *) palloc(sizeof(POLYGON));
MemSet((char *) p, 0, sizeof(POLYGON)); /* zero any holes */
p = (POLYGON *) palloc0(sizeof(POLYGON)); /* zero any holes */
p->size = sizeof(POLYGON);
p->npts = 0;
p->boundbox.high.x = Max(a->boundbox.high.x, b->boundbox.high.x);
@@ -127,9 +125,7 @@ rt_poly_inter(PG_FUNCTION_ARGS)
POLYGON *b = PG_GETARG_POLYGON_P(1);
POLYGON *p;
p = (POLYGON *) palloc(sizeof(POLYGON));
MemSet((char *) p, 0, sizeof(POLYGON)); /* zero any holes */
p = (POLYGON *) palloc0(sizeof(POLYGON)); /* zero any holes */
p->size = sizeof(POLYGON);
p->npts = 0;
p->boundbox.high.x = Min(a->boundbox.high.x, b->boundbox.high.x);