rsinfo->setDesc = tupdesc;
MemoryContextSwitchTo(oldcontext);
- values = (char **) palloc(nfields * sizeof(char *));
+ values = palloc_array(char *, nfields);
/* put all tuples into the tuplestore */
for (row = 0; row < ntuples; row++)
*/
if (sinfo->cstrs)
pfree(sinfo->cstrs);
- sinfo->cstrs = (char **) palloc(nfields * sizeof(char *));
+ sinfo->cstrs = palloc_array(char *, nfields);
}
/* Should have a single-row result if we get here */
HeapTuple tuple;
Datum result;
- values = (char **) palloc(2 * sizeof(char *));
+ values = palloc_array(char *, 2);
values[0] = psprintf("%d", call_cntr + 1);
values[1] = results[call_cntr];
*indnkeyatts = index->indnkeyatts;
if (*indnkeyatts > 0)
{
- result = (char **) palloc(*indnkeyatts * sizeof(char *));
+ result = palloc_array(char *, *indnkeyatts);
for (i = 0; i < *indnkeyatts; i++)
result[i] = SPI_fname(tupdesc, index->indkey.values[i]);
get_typlenbyvalalign(ARR_ELEMTYPE(array),
&typlen, &typbyval, &typalign);
- values = (char **) palloc(nitems * sizeof(char *));
+ values = palloc_array(char *, nitems);
ptr = ARR_DATA_PTR(array);
bitmap = ARR_NULLBITMAP(array);
errmsg("number of key attributes must be > 0")));
/* Allocate output array */
- *pkattnums = (int *) palloc(pknumatts_arg * sizeof(int));
+ *pkattnums = palloc_array(int, pknumatts_arg);
*pknumatts = pknumatts_arg;
/* Validate attnums and convert to internal form */
scan = RelationGetIndexScan(r, nkeys, norderbys);
- opaque = (BrinOpaque *) palloc(sizeof(BrinOpaque));
+ opaque = palloc_object(BrinOpaque);
opaque->bo_rmAccess = brinRevmapInitialize(r, &opaque->bo_pagesPerRange,
scan->xs_snapshot);
opaque->bo_bdesc = brin_build_desc(r);
* don't look them up here; we do that lazily the first time we see a scan
* key reference each of them. We rely on zeroing fn_oid to InvalidOid.
*/
- consistentFn = palloc0(sizeof(FmgrInfo) * bdesc->bd_tupdesc->natts);
+ consistentFn = palloc0_array(FmgrInfo, bdesc->bd_tupdesc->natts);
/*
* Make room for per-attribute lists of scan keys that we'll pass to the
/*
* Return statistics
*/
- result = (IndexBuildResult *) palloc(sizeof(IndexBuildResult));
+ result = palloc_object(IndexBuildResult);
result->heap_tuples = reltuples;
result->index_tuples = idxtuples;
{
/* allocate stats if first time through, else re-use existing struct */
if (stats == NULL)
- stats = (IndexBulkDeleteResult *) palloc0(sizeof(IndexBulkDeleteResult));
+ stats = palloc0_object(IndexBulkDeleteResult);
return stats;
}
return stats;
if (!stats)
- stats = (IndexBulkDeleteResult *) palloc0(sizeof(IndexBulkDeleteResult));
+ stats = palloc0_object(IndexBulkDeleteResult);
stats->num_pages = RelationGetNumberOfBlocks(info->index);
/* rest of stats is initialized by zeroing */
* Obtain BrinOpcInfo for each indexed column. While at it, accumulate
* the number of columns stored, since the number is opclass-defined.
*/
- opcinfo = (BrinOpcInfo **) palloc(sizeof(BrinOpcInfo *) * tupdesc->natts);
+ opcinfo = palloc_array(BrinOpcInfo*, tupdesc->natts);
for (keyno = 0; keyno < tupdesc->natts; keyno++)
{
FmgrInfo *opcInfoFn;
{
BrinBuildState *state;
- state = palloc(sizeof(BrinBuildState));
+ state = palloc_object(BrinBuildState);
state->bs_irel = idxRel;
state->bs_numtuples = 0;
* resizing (since palloc likes powers of 2).
*/
collector->lentuples = pg_nextpower2_32(Max(16, nentries));
- collector->tuples = (IndexTuple *) palloc(sizeof(IndexTuple) * collector->lentuples);
+ collector->tuples = palloc_array(IndexTuple, collector->lentuples);
}
else if (collector->lentuples < collector->ntuples + nentries)
{
* MaxAllocSize/sizeof(IndexTuple), causing an error in repalloc.
*/
collector->lentuples = pg_nextpower2_32(collector->ntuples + nentries);
- collector->tuples = (IndexTuple *) repalloc(collector->tuples,
- sizeof(IndexTuple) * collector->lentuples);
+ collector->tuples = repalloc_array(collector->tuples,
+ IndexTuple, collector->lentuples);
}
/*
static void
initKeyArray(KeyArray *keys, int32 maxvalues)
{
- keys->keys = (Datum *) palloc(sizeof(Datum) * maxvalues);
- keys->categories = (GinNullCategory *)
- palloc(sizeof(GinNullCategory) * maxvalues);
+ keys->keys = palloc_array(Datum, maxvalues);
+ keys->categories = palloc_array(GinNullCategory, maxvalues);
keys->nvalues = 0;
keys->maxvalues = maxvalues;
}
if (keys->nvalues >= keys->maxvalues)
{
keys->maxvalues *= 2;
- keys->keys = (Datum *)
- repalloc(keys->keys, sizeof(Datum) * keys->maxvalues);
- keys->categories = (GinNullCategory *)
- repalloc(keys->categories, sizeof(GinNullCategory) * keys->maxvalues);
+ keys->keys = repalloc_array(keys->keys, Datum, keys->maxvalues);
+ keys->categories = repalloc_array(keys->categories, GinNullCategory, keys->maxvalues);
}
keys->keys[keys->nvalues] = datum;
*/
indexInfo = makeIndexInfo(numberOfAttributes, numberOfAttributes,
accessMethodId, NIL, NIL, false, false, false, false);
- typeObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
- collationObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
- classObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
- coloptions = (int16 *) palloc(numberOfAttributes * sizeof(int16));
+ typeObjectId = palloc_array(Oid, numberOfAttributes);
+ collationObjectId = palloc_array(Oid, numberOfAttributes);
+ classObjectId = palloc_array(Oid, numberOfAttributes);
+ coloptions = palloc_array(int16, numberOfAttributes);
ComputeIndexAttrs(indexInfo,
typeObjectId, collationObjectId, classObjectId,
coloptions, attributeList,
!concurrent,
concurrent);
- typeObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
- collationObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
- classObjectId = (Oid *) palloc(numberOfAttributes * sizeof(Oid));
- coloptions = (int16 *) palloc(numberOfAttributes * sizeof(int16));
+ typeObjectId = palloc_array(Oid, numberOfAttributes);
+ collationObjectId = palloc_array(Oid, numberOfAttributes);
+ classObjectId = palloc_array(Oid, numberOfAttributes);
+ coloptions = palloc_array(int16, numberOfAttributes);
ComputeIndexAttrs(indexInfo,
typeObjectId, collationObjectId, classObjectId,
coloptions, allIndexParams,
if ((!stmt->relation || stmt->relation->inh) && partdesc->nparts > 0)
{
int nparts = partdesc->nparts;
- Oid *part_oids = palloc(sizeof(Oid) * nparts);
+ Oid *part_oids = palloc_array(Oid, nparts);
bool invalidate_parent = false;
Relation parentIndex;
TupleDesc parentDesc;
if (exclusionOpNames)
{
Assert(list_length(exclusionOpNames) == nkeycols);
- indexInfo->ii_ExclusionOps = (Oid *) palloc(sizeof(Oid) * nkeycols);
- indexInfo->ii_ExclusionProcs = (Oid *) palloc(sizeof(Oid) * nkeycols);
- indexInfo->ii_ExclusionStrats = (uint16 *) palloc(sizeof(uint16) * nkeycols);
+ indexInfo->ii_ExclusionOps = palloc_array(Oid, nkeycols);
+ indexInfo->ii_ExclusionProcs = palloc_array(Oid, nkeycols);
+ indexInfo->ii_ExclusionStrats = palloc_array(uint16, nkeycols);
nextExclOp = list_head(exclusionOpNames);
}
else
if (!indexInfo->ii_OpclassOptions)
indexInfo->ii_OpclassOptions =
- palloc0(sizeof(Datum) * indexInfo->ii_NumIndexAttrs);
+ palloc0_array(Datum, indexInfo->ii_NumIndexAttrs);
indexInfo->ii_OpclassOptions[attn] =
transformRelOptions((Datum) 0, attribute->opclassopts,
/* Save the list of relation OIDs in private context */
oldcontext = MemoryContextSwitchTo(private_context);
- idx = palloc(sizeof(ReindexIndexInfo));
+ idx = palloc_object(ReindexIndexInfo);
idx->indexId = cellOid;
/* other fields set later */
*/
oldcontext = MemoryContextSwitchTo(private_context);
- idx = palloc(sizeof(ReindexIndexInfo));
+ idx = palloc_object(ReindexIndexInfo);
idx->indexId = cellOid;
indexIds = lappend(indexIds, idx);
/* other fields set later */
* Save the list of relation OIDs in private context. Note
* that invalid indexes are allowed here.
*/
- idx = palloc(sizeof(ReindexIndexInfo));
+ idx = palloc_object(ReindexIndexInfo);
idx->indexId = relationOid;
indexIds = lappend(indexIds, idx);
/* other fields set later */
*/
oldcontext = MemoryContextSwitchTo(private_context);
- newidx = palloc(sizeof(ReindexIndexInfo));
+ newidx = palloc_object(ReindexIndexInfo);
newidx->indexId = newIndexId;
newidx->safe = idx->safe;
newidx->tableId = idx->tableId;
* avoid multiple locks taken on the same relation, instead we rely on
* parentRelationIds built earlier.
*/
- lockrelid = palloc(sizeof(*lockrelid));
+ lockrelid = palloc_object(LockRelId);
*lockrelid = indexRel->rd_lockInfo.lockRelId;
relationLocks = lappend(relationLocks, lockrelid);
- lockrelid = palloc(sizeof(*lockrelid));
+ lockrelid = palloc_object(LockRelId);
*lockrelid = newIndexRel->rd_lockInfo.lockRelId;
relationLocks = lappend(relationLocks, lockrelid);
oldcontext = MemoryContextSwitchTo(private_context);
/* Add lockrelid of heap relation to the list of locked relations */
- lockrelid = palloc(sizeof(*lockrelid));
+ lockrelid = palloc_object(LockRelId);
*lockrelid = heapRelation->rd_lockInfo.lockRelId;
relationLocks = lappend(relationLocks, lockrelid);
- heaplocktag = (LOCKTAG *) palloc(sizeof(LOCKTAG));
+ heaplocktag = palloc_object(LOCKTAG);
/* Save the LOCKTAG for this parent relation for the wait phase */
SET_LOCKTAG_RELATION(*heaplocktag, lockrelid->dbId, lockrelid->relId);
int i;
ListCell *l;
- argtypes = (Oid *) palloc(nargs * sizeof(Oid));
+ argtypes = palloc_array(Oid, nargs);
i = 0;
foreach(l, stmt->argtypes)
{
Oid *result_types;
- result_types = (Oid *) palloc(result_desc->natts * sizeof(Oid));
+ result_types = palloc_array(Oid, result_desc->natts);
for (int i = 0; i < result_desc->natts; i++)
result_types[i] = result_desc->attrs[i].atttypid;
values[4] = build_regtype_array(result_types, result_desc->natts);
ArrayType *result;
int i;
- tmp_ary = (Datum *) palloc(num_params * sizeof(Datum));
+ tmp_ary = palloc_array(Datum, num_params);
for (i = 0; i < num_params; i++)
tmp_ary[i] = ObjectIdGetDatum(param_types[i]);
* per-query memory context. Everything else should be kept inside the
* subsidiary hashCxt or batchCxt.
*/
- hashtable = (HashJoinTable) palloc(sizeof(HashJoinTableData));
+ hashtable = palloc_object(HashJoinTableData);
hashtable->nbuckets = nbuckets;
hashtable->nbuckets_original = nbuckets;
hashtable->nbuckets_optimal = nbuckets;
* remember whether the join operators are strict.
*/
nkeys = list_length(hashOperators);
- hashtable->outer_hashfunctions =
- (FmgrInfo *) palloc(nkeys * sizeof(FmgrInfo));
- hashtable->inner_hashfunctions =
- (FmgrInfo *) palloc(nkeys * sizeof(FmgrInfo));
- hashtable->hashStrict = (bool *) palloc(nkeys * sizeof(bool));
- hashtable->collations = (Oid *) palloc(nkeys * sizeof(Oid));
+ hashtable->outer_hashfunctions = palloc_array(FmgrInfo, nkeys);
+ hashtable->inner_hashfunctions = palloc_array(FmgrInfo, nkeys);
+ hashtable->hashStrict = palloc_array(bool, nkeys);
+ hashtable->collations = palloc_array(Oid, nkeys);
i = 0;
forboth(ho, hashOperators, hc, hashCollations)
{
* allocate and initialize the file arrays in hashCxt (not needed for
* parallel case which uses shared tuplestores instead of raw files)
*/
- hashtable->innerBatchFile = (BufFile **)
- palloc0(nbatch * sizeof(BufFile *));
- hashtable->outerBatchFile = (BufFile **)
- palloc0(nbatch * sizeof(BufFile *));
+ hashtable->innerBatchFile = palloc0_array(BufFile *, nbatch);
+ hashtable->outerBatchFile = palloc0_array(BufFile *, nbatch);
/* The files will not be opened until needed... */
/* ... but make sure we have temp tablespaces established for them */
PrepareTempTablespaces();
*/
MemoryContextSwitchTo(hashtable->batchCxt);
- hashtable->buckets.unshared = (HashJoinTuple *)
- palloc0(nbuckets * sizeof(HashJoinTuple));
+ hashtable->buckets.unshared = palloc0_array(HashJoinTuple, nbuckets);
/*
* Set up for skew optimization, if possible and there's a need for
if (hashtable->innerBatchFile == NULL)
{
/* we had no file arrays before */
- hashtable->innerBatchFile = (BufFile **)
- palloc0(nbatch * sizeof(BufFile *));
- hashtable->outerBatchFile = (BufFile **)
- palloc0(nbatch * sizeof(BufFile *));
+ hashtable->innerBatchFile = palloc0_array(BufFile *, nbatch);
+ hashtable->outerBatchFile = palloc0_array(BufFile *, nbatch);
/* time to establish the temp tablespaces, too */
PrepareTempTablespaces();
}
else
{
/* enlarge arrays and zero out added entries */
- hashtable->innerBatchFile = (BufFile **)
- repalloc(hashtable->innerBatchFile, nbatch * sizeof(BufFile *));
- hashtable->outerBatchFile = (BufFile **)
- repalloc(hashtable->outerBatchFile, nbatch * sizeof(BufFile *));
+ hashtable->innerBatchFile = repalloc_array(hashtable->innerBatchFile, BufFile *, nbatch);
+ hashtable->outerBatchFile = repalloc_array(hashtable->outerBatchFile, BufFile *, nbatch);
MemSet(hashtable->innerBatchFile + oldnbatch, 0,
(nbatch - oldnbatch) * sizeof(BufFile *));
MemSet(hashtable->outerBatchFile + oldnbatch, 0,
hashtable->log2_nbuckets = hashtable->log2_nbuckets_optimal;
hashtable->buckets.unshared =
- repalloc(hashtable->buckets.unshared,
- sizeof(HashJoinTuple) * hashtable->nbuckets);
+ repalloc_array(hashtable->buckets.unshared,
+ HashJoinTuple, hashtable->nbuckets);
}
/*
/* Get our hands on the previous generation of batches. */
old_batches = (ParallelHashJoinBatch *)
dsa_get_address(hashtable->area, pstate->old_batches);
- old_inner_tuples = palloc0(sizeof(SharedTuplestoreAccessor *) * old_nbatch);
+ old_inner_tuples = palloc0_array(SharedTuplestoreAccessor *, old_nbatch);
for (i = 1; i < old_nbatch; ++i)
{
ParallelHashJoinBatch *shared =
* chunks)
*/
hashtable->buckets.unshared =
- (HashJoinTuple *) repalloc(hashtable->buckets.unshared,
- hashtable->nbuckets * sizeof(HashJoinTuple));
+ repalloc_array(hashtable->buckets.unshared,
+ HashJoinTuple, hashtable->nbuckets);
memset(hashtable->buckets.unshared, 0,
hashtable->nbuckets * sizeof(HashJoinTuple));
oldcxt = MemoryContextSwitchTo(hashtable->batchCxt);
/* Reallocate and reinitialize the hash bucket headers. */
- hashtable->buckets.unshared = (HashJoinTuple *)
- palloc0(nbuckets * sizeof(HashJoinTuple));
+ hashtable->buckets.unshared = palloc0_array(HashJoinTuple, nbuckets);
hashtable->spaceUsed = 0;
{
/* Allocate save space if EXPLAIN'ing and we didn't do so already */
if (node->ps.instrument && !node->hinstrument)
- node->hinstrument = (HashInstrumentation *)
- palloc0(sizeof(HashInstrumentation));
+ node->hinstrument = palloc0_object(HashInstrumentation);
/* Now accumulate data for the current (final) hash table */
if (node->hinstrument && node->hashtable)
ExecHashAccumInstrumentation(node->hinstrument, node->hashtable);
/* Allocate this backend's accessor array. */
hashtable->nbatch = nbatch;
- hashtable->batches = (ParallelHashJoinBatchAccessor *)
- palloc0(sizeof(ParallelHashJoinBatchAccessor) * hashtable->nbatch);
+ hashtable->batches =
+ palloc0_array(ParallelHashJoinBatchAccessor, hashtable->nbatch);
/* Set up the shared state, tuplestores and backend-local accessors. */
for (i = 0; i < hashtable->nbatch; ++i)
/* Allocate this backend's accessor array. */
hashtable->nbatch = pstate->nbatch;
- hashtable->batches = (ParallelHashJoinBatchAccessor *)
- palloc0(sizeof(ParallelHashJoinBatchAccessor) * hashtable->nbatch);
+ hashtable->batches =
+ palloc0_array(ParallelHashJoinBatchAccessor, hashtable->nbatch);
/* Find the base of the pseudo-array of ParallelHashJoinBatch objects. */
batches = (ParallelHashJoinBatch *)
numPFormats = pq_getmsgint(input_message, 2);
if (numPFormats > 0)
{
- pformats = (int16 *) palloc(numPFormats * sizeof(int16));
+ pformats = palloc_array(int16, numPFormats);
for (int i = 0; i < numPFormats; i++)
pformats[i] = pq_getmsgint(input_message, 2);
}
oldcxt = MemoryContextSwitchTo(MessageContext);
if (knownTextValues == NULL)
- knownTextValues =
- palloc0(numParams * sizeof(char *));
+ knownTextValues = palloc0_array(char *, numParams);
if (log_parameter_max_length_on_error < 0)
knownTextValues[paramno] = pstrdup(pstring);
numRFormats = pq_getmsgint(input_message, 2);
if (numRFormats > 0)
{
- rformats = (int16 *) palloc(numRFormats * sizeof(int16));
+ rformats = palloc_array(int16, numRFormats);
for (int i = 0; i < numRFormats; i++)
rformats[i] = pq_getmsgint(input_message, 2);
}
numParams = pq_getmsgint(&input_message, 2);
if (numParams > 0)
{
- paramTypes = (Oid *) palloc(numParams * sizeof(Oid));
+ paramTypes = palloc_array(Oid, numParams);
for (int i = 0; i < numParams; i++)
paramTypes[i] = pq_getmsgint(&input_message, 4);
}
if (parentidx == NULL)
continue;
- attachinfo = (IndexAttachInfo *) pg_malloc(sizeof(IndexAttachInfo));
+ attachinfo = pg_malloc_object(IndexAttachInfo);
attachinfo->dobj.objType = DO_INDEX_ATTACH;
attachinfo->dobj.catId.tableoid = 0;
{
AttrDefInfo *attrDef;
- attrDef = (AttrDefInfo *) pg_malloc(sizeof(AttrDefInfo));
+ attrDef = pg_malloc_object(AttrDefInfo);
attrDef->dobj.objType = DO_ATTRDEF;
attrDef->dobj.catId.tableoid = 0;
attrDef->dobj.catId.oid = 0;
if (allocedDumpIds <= 0)
{
newAlloc = 256;
- dumpIdMap = (DumpableObject **)
- pg_malloc(newAlloc * sizeof(DumpableObject *));
+ dumpIdMap = pg_malloc_array(DumpableObject *, newAlloc);
}
else
{
newAlloc = allocedDumpIds * 2;
- dumpIdMap = (DumpableObject **)
- pg_realloc(dumpIdMap, newAlloc * sizeof(DumpableObject *));
+ dumpIdMap = pg_realloc_array(dumpIdMap, DumpableObject *, newAlloc);
}
memset(dumpIdMap + allocedDumpIds, 0,
(newAlloc - allocedDumpIds) * sizeof(DumpableObject *));
int i,
j;
- *objs = (DumpableObject **)
- pg_malloc(allocedDumpIds * sizeof(DumpableObject *));
+ *objs = pg_malloc_array(DumpableObject *, allocedDumpIds);
j = 0;
for (i = 1; i < allocedDumpIds; i++)
{
if (dobj->allocDeps <= 0)
{
dobj->allocDeps = 16;
- dobj->dependencies = (DumpId *)
- pg_malloc(dobj->allocDeps * sizeof(DumpId));
+ dobj->dependencies = pg_malloc_array(DumpId, dobj->allocDeps);
}
else
{
dobj->allocDeps *= 2;
- dobj->dependencies = (DumpId *)
- pg_realloc(dobj->dependencies,
- dobj->allocDeps * sizeof(DumpId));
+ dobj->dependencies = pg_realloc_array(dobj->dependencies,
+ DumpId, dobj->allocDeps);
}
}
dobj->dependencies[dobj->nDeps++] = refId;
if (numParents > 0)
{
- self->parents = (TableInfo **)
- pg_malloc(sizeof(TableInfo *) * numParents);
+ self->parents = pg_malloc_array(TableInfo *, numParents);
j = 0;
for (i = 0; i < numInherits; i++)
{
/*
* Set up some special context used in compressing data.
*/
- ctx = (lclContext *) pg_malloc0(sizeof(lclContext));
+ ctx = pg_malloc0_object(lclContext);
AH->formatData = (void *) ctx;
ctx->filePos = 0;
ctx->isSpecialScript = 0;
lclTocEntry *ctx;
char fn[K_STD_BUF_SIZE];
- ctx = (lclTocEntry *) pg_malloc0(sizeof(lclTocEntry));
+ ctx = pg_malloc0_object(lclTocEntry);
if (te->dataDumper != NULL)
{
snprintf(fn, sizeof(fn), "%d.dat", te->dumpId);
if (ctx == NULL)
{
- ctx = (lclTocEntry *) pg_malloc0(sizeof(lclTocEntry));
+ ctx = pg_malloc0_object(lclTocEntry);
te->formatData = (void *) ctx;
}
{
int old_umask;
- tm = pg_malloc0(sizeof(TAR_MEMBER));
+ tm = pg_malloc0_object(TAR_MEMBER);
/*
* POSIX does not require, but permits, tmpfile() to restrict file
_tarPositionTo(ArchiveHandle *AH, const char *filename)
{
lclContext *ctx = (lclContext *) AH->formatData;
- TAR_MEMBER *th = pg_malloc0(sizeof(TAR_MEMBER));
+ TAR_MEMBER *th = pg_malloc0_object(TAR_MEMBER);
char c;
char header[TAR_BLOCK_SIZE];
size_t i,
do
{
#define PARAMS_ARRAY_SIZE 8
- const char **keywords = pg_malloc(PARAMS_ARRAY_SIZE * sizeof(*keywords));
- const char **values = pg_malloc(PARAMS_ARRAY_SIZE * sizeof(*values));
+ const char **keywords = pg_malloc_array(const char *, PARAMS_ARRAY_SIZE);
+ const char **values = pg_malloc_array(const char *, PARAMS_ARRAY_SIZE);
keywords[0] = "host";
values[0] = options.host;
{
SimpleActionListCell *cell;
- cell = (SimpleActionListCell *) pg_malloc(sizeof(SimpleActionListCell));
+ cell = pg_malloc_object(SimpleActionListCell);
cell->next = NULL;
cell->action = action;
/* Adjust this to match the number of items filled below */
*configdata_len = 23;
- configdata = (ConfigData *) palloc(*configdata_len * sizeof(ConfigData));
+ configdata = palloc_array(ConfigData, *configdata_len);
configdata[i].name = pstrdup("BINDIR");
strlcpy(path, my_exec_path, sizeof(path));
AssertArg(crc_ok_p);
- ControlFile = palloc(sizeof(ControlFileData));
+ ControlFile = palloc_object(ControlFileData);
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
#ifndef FRONTEND