mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Add new palloc0 call as merge of palloc and MemSet(0).
This commit is contained in:
5
src/backend/utils/cache/catcache.c
vendored
5
src/backend/utils/cache/catcache.c
vendored
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.101 2002/11/11 03:02:19 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.102 2002/11/13 00:39:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -808,8 +808,7 @@ InitCatCache(int id,
|
||||
*
|
||||
* Note: we assume zeroing initializes the Dllist headers correctly
|
||||
*/
|
||||
cp = (CatCache *) palloc(sizeof(CatCache) + NCCBUCKETS * sizeof(Dllist));
|
||||
MemSet((char *) cp, 0, sizeof(CatCache) + NCCBUCKETS * sizeof(Dllist));
|
||||
cp = (CatCache *) palloc0(sizeof(CatCache) + NCCBUCKETS * sizeof(Dllist));
|
||||
|
||||
/*
|
||||
* initialize the cache's relation information for the relation
|
||||
|
17
src/backend/utils/cache/relcache.c
vendored
17
src/backend/utils/cache/relcache.c
vendored
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.179 2002/11/11 03:02:19 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.180 2002/11/13 00:39:47 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1348,13 +1348,9 @@ formrdesc(const char *relationName,
|
||||
|
||||
/*
|
||||
* allocate new relation desc
|
||||
*/
|
||||
relation = (Relation) palloc(sizeof(RelationData));
|
||||
|
||||
/*
|
||||
* clear all fields of reldesc
|
||||
*/
|
||||
MemSet((char *) relation, 0, sizeof(RelationData));
|
||||
relation = (Relation) palloc0(sizeof(RelationData));
|
||||
relation->rd_targblock = InvalidBlockNumber;
|
||||
|
||||
/* make sure relation is marked as having no open file yet */
|
||||
@ -1380,8 +1376,7 @@ formrdesc(const char *relationName,
|
||||
* get us launched. RelationCacheInitializePhase2() will read the
|
||||
* real data from pg_class and replace what we've done here.
|
||||
*/
|
||||
relation->rd_rel = (Form_pg_class) palloc(CLASS_TUPLE_SIZE);
|
||||
MemSet(relation->rd_rel, 0, CLASS_TUPLE_SIZE);
|
||||
relation->rd_rel = (Form_pg_class) palloc0(CLASS_TUPLE_SIZE);
|
||||
|
||||
namestrcpy(&relation->rd_rel->relname, relationName);
|
||||
relation->rd_rel->relnamespace = PG_CATALOG_NAMESPACE;
|
||||
@ -2054,8 +2049,7 @@ RelationBuildLocalRelation(const char *relname,
|
||||
/*
|
||||
* allocate a new relation descriptor and fill in basic state fields.
|
||||
*/
|
||||
rel = (Relation) palloc(sizeof(RelationData));
|
||||
MemSet((char *) rel, 0, sizeof(RelationData));
|
||||
rel = (Relation) palloc0(sizeof(RelationData));
|
||||
|
||||
rel->rd_targblock = InvalidBlockNumber;
|
||||
|
||||
@ -2093,8 +2087,7 @@ RelationBuildLocalRelation(const char *relname,
|
||||
/*
|
||||
* initialize relation tuple form (caller may add/override data later)
|
||||
*/
|
||||
rel->rd_rel = (Form_pg_class) palloc(CLASS_TUPLE_SIZE);
|
||||
MemSet((char *) rel->rd_rel, 0, CLASS_TUPLE_SIZE);
|
||||
rel->rd_rel = (Form_pg_class) palloc0(CLASS_TUPLE_SIZE);
|
||||
|
||||
namestrcpy(&rel->rd_rel->relname, relname);
|
||||
rel->rd_rel->relnamespace = relnamespace;
|
||||
|
Reference in New Issue
Block a user