1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00

Merge palloc()/MemSet(0) calls into a single palloc0() call.

This commit is contained in:
Bruce Momjian
2002-11-10 07:25:14 +00:00
parent 78822b328c
commit 8fee9615cc
37 changed files with 107 additions and 210 deletions

View File

@ -78,7 +78,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.29 2002/10/31 19:11:48 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.30 2002/11/10 07:25:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -414,9 +414,7 @@ tuplesort_begin_common(bool randomAccess)
{
Tuplesortstate *state;
state = (Tuplesortstate *) palloc(sizeof(Tuplesortstate));
MemSet((char *) state, 0, sizeof(Tuplesortstate));
state = (Tuplesortstate *) palloc0(sizeof(Tuplesortstate));
state->status = TSS_INITIAL;
state->randomAccess = randomAccess;
@ -459,11 +457,9 @@ tuplesort_begin_heap(TupleDesc tupDesc,
state->tupDesc = tupDesc;
state->nKeys = nkeys;
state->scanKeys = (ScanKey) palloc(nkeys * sizeof(ScanKeyData));
MemSet(state->scanKeys, 0, nkeys * sizeof(ScanKeyData));
state->scanKeys = (ScanKey) palloc0(nkeys * sizeof(ScanKeyData));
state->sortFnKinds = (SortFunctionKind *)
palloc(nkeys * sizeof(SortFunctionKind));
MemSet(state->sortFnKinds, 0, nkeys * sizeof(SortFunctionKind));
palloc0(nkeys * sizeof(SortFunctionKind));
for (i = 0; i < nkeys; i++)
{

View File

@ -26,7 +26,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplestore.c,v 1.7 2002/08/12 00:36:12 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplestore.c,v 1.8 2002/11/10 07:25:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -197,9 +197,7 @@ tuplestore_begin_common(bool randomAccess, int maxKBytes)
{
Tuplestorestate *state;
state = (Tuplestorestate *) palloc(sizeof(Tuplestorestate));
MemSet((char *) state, 0, sizeof(Tuplestorestate));
state = (Tuplestorestate *) palloc0(sizeof(Tuplestorestate));
state->status = TSS_INITIAL;
state->randomAccess = randomAccess;