summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/amcheck/verify_heapam.c6
-rw-r--r--contrib/bloom/blcost.c4
-rw-r--r--contrib/pageinspect/brinfuncs.c7
-rw-r--r--contrib/pageinspect/hashfuncs.c16
-rw-r--r--contrib/pageinspect/heapfuncs.c8
-rw-r--r--contrib/pg_prewarm/autoprewarm.c6
-rw-r--r--contrib/pg_stat_statements/pg_stat_statements.c7
-rw-r--r--contrib/pg_visibility/pg_visibility.c15
-rw-r--r--contrib/pg_walinspect/pg_walinspect.c25
-rw-r--r--contrib/pgstattuple/pgstatindex.c3
-rw-r--r--contrib/postgres_fdw/connection.c7
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c3
12 files changed, 31 insertions, 76 deletions
diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c
index e488f5e234b..d33f33f1703 100644
--- a/contrib/amcheck/verify_heapam.c
+++ b/contrib/amcheck/verify_heapam.c
@@ -554,12 +554,10 @@ report_corruption_internal(Tuplestorestate *tupstore, TupleDesc tupdesc,
BlockNumber blkno, OffsetNumber offnum,
AttrNumber attnum, char *msg)
{
- Datum values[HEAPCHECK_RELATION_COLS];
- bool nulls[HEAPCHECK_RELATION_COLS];
+ Datum values[HEAPCHECK_RELATION_COLS] = {0};
+ bool nulls[HEAPCHECK_RELATION_COLS] = {0};
HeapTuple tuple;
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int64GetDatum(blkno);
values[1] = Int32GetDatum(offnum);
values[2] = Int32GetDatum(attnum);
diff --git a/contrib/bloom/blcost.c b/contrib/bloom/blcost.c
index d42e4e96284..d4b1c763034 100644
--- a/contrib/bloom/blcost.c
+++ b/contrib/bloom/blcost.c
@@ -26,9 +26,7 @@ blcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
- GenericCosts costs;
-
- MemSet(&costs, 0, sizeof(costs));
+ GenericCosts costs = {0};
/* We have to visit all index tuples anyway */
costs.numIndexTuples = index->tuples;
diff --git a/contrib/pageinspect/brinfuncs.c b/contrib/pageinspect/brinfuncs.c
index 879276e6dec..f4c959ecab9 100644
--- a/contrib/pageinspect/brinfuncs.c
+++ b/contrib/pageinspect/brinfuncs.c
@@ -202,7 +202,7 @@ brin_page_items(PG_FUNCTION_ARGS)
for (;;)
{
Datum values[7];
- bool nulls[7];
+ bool nulls[7] = {0};
/*
* This loop is called once for every attribute of every tuple in the
@@ -230,8 +230,6 @@ brin_page_items(PG_FUNCTION_ARGS)
else
attno++;
- MemSet(nulls, 0, sizeof(nulls));
-
if (unusedItem)
{
values[0] = UInt16GetDatum(offset);
@@ -334,7 +332,7 @@ brin_metapage_info(PG_FUNCTION_ARGS)
BrinMetaPageData *meta;
TupleDesc tupdesc;
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
HeapTuple htup;
if (!superuser())
@@ -354,7 +352,6 @@ brin_metapage_info(PG_FUNCTION_ARGS)
/* Extract values from the metapage */
meta = (BrinMetaPageData *) PageGetContents(page);
- MemSet(nulls, 0, sizeof(nulls));
values[0] = CStringGetTextDatum(psprintf("0x%08X", meta->brinMagic));
values[1] = Int32GetDatum(meta->brinVersion);
values[2] = Int32GetDatum(meta->pagesPerRange);
diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c
index 5287dbe1a30..81815392d70 100644
--- a/contrib/pageinspect/hashfuncs.c
+++ b/contrib/pageinspect/hashfuncs.c
@@ -238,7 +238,7 @@ hash_page_stats(PG_FUNCTION_ARGS)
Page page;
int j;
Datum values[9];
- bool nulls[9];
+ bool nulls[9] = {0};
HashPageStat stat;
HeapTuple tuple;
TupleDesc tupleDesc;
@@ -261,8 +261,6 @@ hash_page_stats(PG_FUNCTION_ARGS)
elog(ERROR, "return type must be a row type");
tupleDesc = BlessTupleDesc(tupleDesc);
- MemSet(nulls, 0, sizeof(nulls));
-
j = 0;
values[j++] = Int32GetDatum(stat.live_items);
values[j++] = Int32GetDatum(stat.dead_items);
@@ -303,7 +301,7 @@ hash_page_items(PG_FUNCTION_ARGS)
Page page;
Datum result;
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
uint32 hashkey;
HeapTuple tuple;
FuncCallContext *fctx;
@@ -361,8 +359,6 @@ hash_page_items(PG_FUNCTION_ARGS)
itup = (IndexTuple) PageGetItem(uargs->page, id);
- MemSet(nulls, 0, sizeof(nulls));
-
j = 0;
values[j++] = Int32GetDatum((int32) uargs->offset);
values[j++] = PointerGetDatum(&itup->t_tid);
@@ -409,7 +405,7 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
int i,
j;
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
uint32 *freep;
if (!superuser())
@@ -495,8 +491,6 @@ hash_bitmap_info(PG_FUNCTION_ARGS)
elog(ERROR, "return type must be a row type");
tupleDesc = BlessTupleDesc(tupleDesc);
- MemSet(nulls, 0, sizeof(nulls));
-
j = 0;
values[j++] = Int64GetDatum((int64) bitmapblkno);
values[j++] = Int32GetDatum(bitmapbit);
@@ -526,7 +520,7 @@ hash_metapage_info(PG_FUNCTION_ARGS)
int i,
j;
Datum values[16];
- bool nulls[16];
+ bool nulls[16] = {0};
Datum spares[HASH_MAX_SPLITPOINTS];
Datum mapp[HASH_MAX_BITMAPS];
@@ -544,8 +538,6 @@ hash_metapage_info(PG_FUNCTION_ARGS)
metad = HashPageGetMeta(page);
- MemSet(nulls, 0, sizeof(nulls));
-
j = 0;
values[j++] = Int64GetDatum((int64) metad->hashm_magic);
values[j++] = Int64GetDatum((int64) metad->hashm_version);
diff --git a/contrib/pageinspect/heapfuncs.c b/contrib/pageinspect/heapfuncs.c
index a654234c6bd..2ff70405cf8 100644
--- a/contrib/pageinspect/heapfuncs.c
+++ b/contrib/pageinspect/heapfuncs.c
@@ -507,8 +507,8 @@ Datum
heap_tuple_infomask_flags(PG_FUNCTION_ARGS)
{
#define HEAP_TUPLE_INFOMASK_COLS 2
- Datum values[HEAP_TUPLE_INFOMASK_COLS];
- bool nulls[HEAP_TUPLE_INFOMASK_COLS];
+ Datum values[HEAP_TUPLE_INFOMASK_COLS] = {0};
+ bool nulls[HEAP_TUPLE_INFOMASK_COLS] = {0};
uint16 t_infomask = PG_GETARG_INT16(0);
uint16 t_infomask2 = PG_GETARG_INT16(1);
int cnt = 0;
@@ -530,10 +530,6 @@ heap_tuple_infomask_flags(PG_FUNCTION_ARGS)
bitcnt = pg_popcount((const char *) &t_infomask, sizeof(uint16)) +
pg_popcount((const char *) &t_infomask2, sizeof(uint16));
- /* Initialize values and NULL flags arrays */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* If no flags, return a set of empty arrays */
if (bitcnt <= 0)
{
diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c
index 13eee4a1379..ee20e9b0850 100644
--- a/contrib/pg_prewarm/autoprewarm.c
+++ b/contrib/pg_prewarm/autoprewarm.c
@@ -814,12 +814,11 @@ apw_detach_shmem(int code, Datum arg)
static void
apw_start_leader_worker(void)
{
- BackgroundWorker worker;
+ BackgroundWorker worker = {0};
BackgroundWorkerHandle *handle;
BgwHandleStatus status;
pid_t pid;
- MemSet(&worker, 0, sizeof(BackgroundWorker));
worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
worker.bgw_start_time = BgWorkerStart_ConsistentState;
strcpy(worker.bgw_library_name, "pg_prewarm");
@@ -856,10 +855,9 @@ apw_start_leader_worker(void)
static void
apw_start_database_worker(void)
{
- BackgroundWorker worker;
+ BackgroundWorker worker = {0};
BackgroundWorkerHandle *handle;
- MemSet(&worker, 0, sizeof(BackgroundWorker));
worker.bgw_flags =
BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION;
worker.bgw_start_time = BgWorkerStart_ConsistentState;
diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c
index 4acfddcdb87..b4d4231dc61 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.c
+++ b/contrib/pg_stat_statements/pg_stat_statements.c
@@ -1854,8 +1854,8 @@ pg_stat_statements_info(PG_FUNCTION_ARGS)
{
pgssGlobalStats stats;
TupleDesc tupdesc;
- Datum values[PG_STAT_STATEMENTS_INFO_COLS];
- bool nulls[PG_STAT_STATEMENTS_INFO_COLS];
+ Datum values[PG_STAT_STATEMENTS_INFO_COLS] = {0};
+ bool nulls[PG_STAT_STATEMENTS_INFO_COLS] = {0};
if (!pgss || !pgss_hash)
ereport(ERROR,
@@ -1866,9 +1866,6 @@ pg_stat_statements_info(PG_FUNCTION_ARGS)
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* Read global statistics for pg_stat_statements */
{
volatile pgssSharedState *s = (volatile pgssSharedState *) pgss;
diff --git a/contrib/pg_visibility/pg_visibility.c b/contrib/pg_visibility/pg_visibility.c
index 4e2e9ea9bbe..a95f73ec796 100644
--- a/contrib/pg_visibility/pg_visibility.c
+++ b/contrib/pg_visibility/pg_visibility.c
@@ -75,7 +75,7 @@ pg_visibility_map(PG_FUNCTION_ARGS)
Buffer vmbuffer = InvalidBuffer;
TupleDesc tupdesc;
Datum values[2];
- bool nulls[2];
+ bool nulls[2] = {0};
rel = relation_open(relid, AccessShareLock);
@@ -88,7 +88,6 @@ pg_visibility_map(PG_FUNCTION_ARGS)
errmsg("invalid block number")));
tupdesc = pg_visibility_tupdesc(false, false);
- MemSet(nulls, 0, sizeof(nulls));
mapbits = (int32) visibilitymap_get_status(rel, blkno, &vmbuffer);
if (vmbuffer != InvalidBuffer)
@@ -117,7 +116,7 @@ pg_visibility(PG_FUNCTION_ARGS)
Page page;
TupleDesc tupdesc;
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
rel = relation_open(relid, AccessShareLock);
@@ -130,7 +129,6 @@ pg_visibility(PG_FUNCTION_ARGS)
errmsg("invalid block number")));
tupdesc = pg_visibility_tupdesc(false, true);
- MemSet(nulls, 0, sizeof(nulls));
mapbits = (int32) visibilitymap_get_status(rel, blkno, &vmbuffer);
if (vmbuffer != InvalidBuffer)
@@ -188,10 +186,9 @@ pg_visibility_map_rel(PG_FUNCTION_ARGS)
if (info->next < info->count)
{
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
HeapTuple tuple;
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int64GetDatum(info->next);
values[1] = BoolGetDatum((info->bits[info->next] & (1 << 0)) != 0);
values[2] = BoolGetDatum((info->bits[info->next] & (1 << 1)) != 0);
@@ -233,10 +230,9 @@ pg_visibility_rel(PG_FUNCTION_ARGS)
if (info->next < info->count)
{
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
HeapTuple tuple;
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int64GetDatum(info->next);
values[1] = BoolGetDatum((info->bits[info->next] & (1 << 0)) != 0);
values[2] = BoolGetDatum((info->bits[info->next] & (1 << 1)) != 0);
@@ -266,7 +262,7 @@ pg_visibility_map_summary(PG_FUNCTION_ARGS)
int64 all_frozen = 0;
TupleDesc tupdesc;
Datum values[2];
- bool nulls[2];
+ bool nulls[2] = {0};
rel = relation_open(relid, AccessShareLock);
@@ -300,7 +296,6 @@ pg_visibility_map_summary(PG_FUNCTION_ARGS)
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "all_frozen", INT8OID, -1, 0);
tupdesc = BlessTupleDesc(tupdesc);
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int64GetDatum(all_visible);
values[1] = Int64GetDatum(all_frozen);
diff --git a/contrib/pg_walinspect/pg_walinspect.c b/contrib/pg_walinspect/pg_walinspect.c
index a082dfb3310..90817876347 100644
--- a/contrib/pg_walinspect/pg_walinspect.c
+++ b/contrib/pg_walinspect/pg_walinspect.c
@@ -229,8 +229,8 @@ pg_get_wal_record_info(PG_FUNCTION_ARGS)
{
#define PG_GET_WAL_RECORD_INFO_COLS 11
Datum result;
- Datum values[PG_GET_WAL_RECORD_INFO_COLS];
- bool nulls[PG_GET_WAL_RECORD_INFO_COLS];
+ Datum values[PG_GET_WAL_RECORD_INFO_COLS] = {0};
+ bool nulls[PG_GET_WAL_RECORD_INFO_COLS] = {0};
XLogRecPtr lsn;
XLogRecPtr curr_lsn;
XLogRecPtr first_record;
@@ -266,9 +266,6 @@ pg_get_wal_record_info(PG_FUNCTION_ARGS)
errmsg("could not read WAL at %X/%X",
LSN_FORMAT_ARGS(first_record))));
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
GetWALRecordInfo(xlogreader, first_record, values, nulls,
PG_GET_WAL_RECORD_INFO_COLS);
@@ -334,8 +331,8 @@ GetWALRecordsInfo(FunctionCallInfo fcinfo, XLogRecPtr start_lsn,
XLogRecPtr first_record;
XLogReaderState *xlogreader;
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
- Datum values[PG_GET_WAL_RECORDS_INFO_COLS];
- bool nulls[PG_GET_WAL_RECORDS_INFO_COLS];
+ Datum values[PG_GET_WAL_RECORDS_INFO_COLS] = {0};
+ bool nulls[PG_GET_WAL_RECORDS_INFO_COLS] = {0};
SetSingleFuncCall(fcinfo, 0);
@@ -343,9 +340,6 @@ GetWALRecordsInfo(FunctionCallInfo fcinfo, XLogRecPtr start_lsn,
Assert(xlogreader);
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
while (ReadNextXLogRecord(xlogreader, first_record) &&
xlogreader->EndRecPtr <= end_lsn)
{
@@ -556,17 +550,15 @@ GetWalStats(FunctionCallInfo fcinfo, XLogRecPtr start_lsn,
#define PG_GET_WAL_STATS_COLS 9
XLogRecPtr first_record;
XLogReaderState *xlogreader;
- XLogStats stats;
+ XLogStats stats = {0};
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
- Datum values[PG_GET_WAL_STATS_COLS];
- bool nulls[PG_GET_WAL_STATS_COLS];
+ Datum values[PG_GET_WAL_STATS_COLS] = {0};
+ bool nulls[PG_GET_WAL_STATS_COLS] = {0};
SetSingleFuncCall(fcinfo, 0);
xlogreader = InitXLogReaderState(start_lsn, &first_record);
- MemSet(&stats, 0, sizeof(stats));
-
while (ReadNextXLogRecord(xlogreader, first_record) &&
xlogreader->EndRecPtr <= end_lsn)
{
@@ -578,9 +570,6 @@ GetWalStats(FunctionCallInfo fcinfo, XLogRecPtr start_lsn,
pfree(xlogreader->private_data);
XLogReaderFree(xlogreader);
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
GetXLogSummaryStats(&stats, rsinfo, values, nulls,
PG_GET_WAL_STATS_COLS,
stats_per_record);
diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c
index e1048e47ff3..d69ac1c93df 100644
--- a/contrib/pgstattuple/pgstatindex.c
+++ b/contrib/pgstattuple/pgstatindex.c
@@ -575,7 +575,7 @@ pgstathashindex(PG_FUNCTION_ARGS)
HeapTuple tuple;
TupleDesc tupleDesc;
Datum values[8];
- bool nulls[8];
+ bool nulls[8] = {0};
Buffer metabuf;
HashMetaPage metap;
float8 free_percent;
@@ -697,7 +697,6 @@ pgstathashindex(PG_FUNCTION_ARGS)
/*
* Build and return the tuple
*/
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int32GetDatum(stats.version);
values[1] = Int64GetDatum((int64) stats.bucket_pages);
values[2] = Int64GetDatum((int64) stats.overflow_pages);
diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c
index cffb6f83107..939d114f02e 100644
--- a/contrib/postgres_fdw/connection.c
+++ b/contrib/postgres_fdw/connection.c
@@ -1678,8 +1678,8 @@ postgres_fdw_get_connections(PG_FUNCTION_ARGS)
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
{
ForeignServer *server;
- Datum values[POSTGRES_FDW_GET_CONNECTIONS_COLS];
- bool nulls[POSTGRES_FDW_GET_CONNECTIONS_COLS];
+ Datum values[POSTGRES_FDW_GET_CONNECTIONS_COLS] = {0};
+ bool nulls[POSTGRES_FDW_GET_CONNECTIONS_COLS] = {0};
/* We only look for open remote connections */
if (!entry->conn)
@@ -1687,9 +1687,6 @@ postgres_fdw_get_connections(PG_FUNCTION_ARGS)
server = GetForeignServerExtended(entry->serverid, FSV_MISSING_OK);
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/*
* The foreign server may have been dropped in current explicit
* transaction. It is not possible to drop the server from another
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 955a428e3da..cfac5390084 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -3307,7 +3307,7 @@ estimate_path_cost_size(PlannerInfo *root,
{
RelOptInfo *outerrel = fpinfo->outerrel;
PgFdwRelationInfo *ofpinfo;
- AggClauseCosts aggcosts;
+ AggClauseCosts aggcosts = {0};
double input_rows;
int numGroupCols;
double numGroups = 1;
@@ -3331,7 +3331,6 @@ estimate_path_cost_size(PlannerInfo *root,
input_rows = ofpinfo->rows;
/* Collect statistics about aggregates for estimating costs. */
- MemSet(&aggcosts, 0, sizeof(AggClauseCosts));
if (root->parse->hasAggs)
{
get_agg_clause_costs(root, AGGSPLIT_SIMPLE, &aggcosts);