"tuple has %d columns but crosstab " \
"returns %d.", tupdesc->natts, result_ncols)));
- /* allocate space */
- values = (char **) palloc(result_ncols * sizeof(char *));
-
- /* and make sure it's clear */
- memset(values, '\0', result_ncols * sizeof(char *));
+ /* allocate space and make sure it's clear */
+ values = (char **) palloc0(result_ncols * sizeof(char *));
for (i = 0; i < proc; i++)
{
#define ROTATEDIST(d) do { \
- SplitedPageLayout *tmp=(SplitedPageLayout*)palloc(sizeof(SplitedPageLayout)); \
- memset(tmp,0,sizeof(SplitedPageLayout)); \
+ SplitedPageLayout *tmp=(SplitedPageLayout*)palloc0(sizeof(SplitedPageLayout)); \
tmp->block.blkno = InvalidBlockNumber; \
tmp->buffer = InvalidBuffer; \
tmp->next = (d); \
bool incomplete_line;
/* Allocate space for the 'wanted' array, and init it */
- ropt->idWanted = (bool *) pg_malloc(sizeof(bool) * AH->maxDumpId);
- memset(ropt->idWanted, 0, sizeof(bool) * AH->maxDumpId);
+ ropt->idWanted = (bool *) pg_malloc0(sizeof(bool) * AH->maxDumpId);
/* Setup the file */
fh = fopen(ropt->tocFile, PG_BINARY_R);
* We also make a map showing the input-order index of the item with
* dumpId j.
*/
- beforeConstraints = (int *) pg_malloc((maxDumpId + 1) * sizeof(int));
- memset(beforeConstraints, 0, (maxDumpId + 1) * sizeof(int));
+ beforeConstraints = (int *) pg_malloc0((maxDumpId + 1) * sizeof(int));
idMap = (int *) pg_malloc((maxDumpId + 1) * sizeof(int));
for (i = 0; i < numObjs; i++)
{
else if ((env = getenv("PGUSER")) != NULL && *env != '\0')
login = env;
- state = (CState *) pg_malloc(sizeof(CState));
- memset(state, 0, sizeof(CState));
+ state = (CState *) pg_malloc0(sizeof(CState));
/* set random seed early, because it may be used while parsing scripts. */
if (!set_random_seed(getenv("PGBENCH_RANDOM_SEED")))