diff --git a/contrib/bloom/blcost.c b/contrib/bloom/blcost.c index d42e4e9628..b35e96ea20 100644 --- a/contrib/bloom/blcost.c +++ b/contrib/bloom/blcost.c @@ -28,7 +28,7 @@ blcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, IndexOptInfo *index = path->indexinfo; GenericCosts costs; - MemSet(&costs, 0, sizeof(costs)); + MemSet(&costs, 0, sizeof(GenericCosts)); /* We have to visit all index tuples anyway */ costs.numIndexTuples = index->tuples; diff --git a/contrib/bloom/blinsert.c b/contrib/bloom/blinsert.c index 82378db441..b80c47cd65 100644 --- a/contrib/bloom/blinsert.c +++ b/contrib/bloom/blinsert.c @@ -132,7 +132,7 @@ blbuild(Relation heap, Relation index, IndexInfo *indexInfo) BloomInitMetapage(index); /* Initialize the bloom build state */ - memset(&buildstate, 0, sizeof(buildstate)); + memset(&buildstate, 0, sizeof(BloomBuildState)); initBloomState(&buildstate.blstate, index); buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext, "Bloom build temporary context", diff --git a/contrib/intarray/_int_selfuncs.c b/contrib/intarray/_int_selfuncs.c index 3d8ff6781b..4ec42e9edf 100644 --- a/contrib/intarray/_int_selfuncs.c +++ b/contrib/intarray/_int_selfuncs.c @@ -221,7 +221,7 @@ _int_matchsel(PG_FUNCTION_ARGS) } } else - memset(&sslot, 0, sizeof(sslot)); + memset(&sslot, 0, sizeof(AttStatsSlot)); /* Process the logical expression in the query, using the stats */ selec = int_query_opr_selec(GETQUERY(query) + query->size - 1, diff --git a/contrib/pg_trgm/trgm_regexp.c b/contrib/pg_trgm/trgm_regexp.c index 58d32ba946..adabb3d8cd 100644 --- a/contrib/pg_trgm/trgm_regexp.c +++ b/contrib/pg_trgm/trgm_regexp.c @@ -926,7 +926,7 @@ transformGraph(TrgmNFA *trgmNFA) trgmNFA->nstates = 0; /* Create initial state: ambiguous prefix, NFA's initial state */ - MemSet(&initkey, 0, sizeof(initkey)); + MemSet(&initkey, 0, sizeof(TrgmStateKey)); initkey.prefix.colors[0] = COLOR_UNKNOWN; initkey.prefix.colors[1] = COLOR_UNKNOWN; initkey.nstate = pg_reg_getinitialstate(trgmNFA->regex); @@ -1028,7 +1028,7 @@ addKey(TrgmNFA *trgmNFA, TrgmState *state, TrgmStateKey *key) * Ensure any pad bytes in destKey are zero, since it may get used as a * hashtable key by getState. */ - MemSet(&destKey, 0, sizeof(destKey)); + MemSet(&destKey, 0, sizeof(TrgmStateKey)); /* * Compare key to each existing enter key of the state to check for @@ -1209,7 +1209,7 @@ addArcs(TrgmNFA *trgmNFA, TrgmState *state) * Ensure any pad bytes in destKey are zero, since it may get used as a * hashtable key by getState. */ - MemSet(&destKey, 0, sizeof(destKey)); + MemSet(&destKey, 0, sizeof(TrgmStateKey)); /* * Iterate over enter keys associated with this expanded-graph state. This diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c index a663852ccf..63fcef562d 100644 --- a/contrib/pgcrypto/crypt-blowfish.c +++ b/contrib/pgcrypto/crypt-blowfish.c @@ -750,7 +750,7 @@ _crypt_blowfish_rn(const char *key, const char *setting, /* Overwrite the most obvious sensitive data we have on the stack. Note * that this does not guarantee there's no sensitive data left on the * stack and/or in registers; I'm not aware of portable code that does. */ - px_memset(&data, 0, sizeof(data)); + px_memset(&data, 0, sizeof(struct data)); return output; } diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c index e1048e47ff..87be62f023 100644 --- a/contrib/pgstattuple/pgstatindex.c +++ b/contrib/pgstattuple/pgstatindex.c @@ -601,7 +601,7 @@ pgstathashindex(PG_FUNCTION_ARGS) errmsg("cannot access temporary indexes of other sessions"))); /* Get the information we need from the metapage. */ - memset(&stats, 0, sizeof(stats)); + memset(&stats, 0, sizeof(HashIndexStat)); metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_READ, LH_META_PAGE); metap = HashPageGetMeta(BufferGetPage(metabuf)); stats.version = metap->hashm_version; diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c index 061ffaf329..20a8162268 100644 --- a/contrib/postgres_fdw/connection.c +++ b/contrib/postgres_fdw/connection.c @@ -311,7 +311,7 @@ make_new_connection(ConnCacheEntry *entry, UserMapping *user) entry->mapping_hashvalue = GetSysCacheHashValue1(USERMAPPINGOID, ObjectIdGetDatum(user->umid)); - memset(&entry->state, 0, sizeof(entry->state)); + memset(&entry->state, 0, sizeof(PgFdwConnState)); /* * Determine whether to keep the connection that we're about to make here @@ -1533,7 +1533,7 @@ pgfdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel) * fetch_more_data(); in that case reset the per-connection state here. */ if (entry->state.pendingAreq) - memset(&entry->state, 0, sizeof(entry->state)); + memset(&entry->state, 0, sizeof(PgFdwConnState)); /* Disarm changing_xact_state if it all worked */ entry->changing_xact_state = false; diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c index 97e61b8043..2882ddb377 100644 --- a/contrib/sepgsql/hooks.c +++ b/contrib/sepgsql/hooks.c @@ -480,5 +480,5 @@ _PG_init(void) ProcessUtility_hook = sepgsql_utility_command; /* init contextual info */ - memset(&sepgsql_context_info, 0, sizeof(sepgsql_context_info)); + memset(&sepgsql_context_info, 0, sizeof(sepgsql_context_info_t)); } diff --git a/src/backend/access/common/scankey.c b/src/backend/access/common/scankey.c index ff2b608f2e..e761f17dd2 100644 --- a/src/backend/access/common/scankey.c +++ b/src/backend/access/common/scankey.c @@ -51,7 +51,7 @@ ScanKeyEntryInitialize(ScanKey entry, else { Assert(flags & (SK_SEARCHNULL | SK_SEARCHNOTNULL)); - MemSet(&entry->sk_func, 0, sizeof(entry->sk_func)); + MemSet(&entry->sk_func, 0, sizeof(FmgrInfo)); } } diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c index 7409fdc165..8119baaacb 100644 --- a/src/backend/access/gin/ginfast.c +++ b/src/backend/access/gin/ginfast.c @@ -1058,7 +1058,7 @@ gin_clean_pending_list(PG_FUNCTION_ARGS) aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_INDEX, RelationGetRelationName(indexRel)); - memset(&stats, 0, sizeof(stats)); + memset(&stats, 0, sizeof(IndexBulkDeleteResult)); initGinState(&ginstate, indexRel); ginInsertCleanup(&ginstate, true, true, true, &stats); diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c index b4fa5f6bf8..451fe28ff1 100644 --- a/src/backend/access/gin/ginvacuum.c +++ b/src/backend/access/gin/ginvacuum.c @@ -721,7 +721,7 @@ ginvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats) false, true, stats); } - memset(&idxStat, 0, sizeof(idxStat)); + memset(&idxStat, 0, sizeof(GinStatsData)); /* * XXX we always report the heap tuple count as the number of index diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c index 2a53826736..01989d79a2 100644 --- a/src/backend/access/heap/rewriteheap.c +++ b/src/backend/access/heap/rewriteheap.c @@ -411,7 +411,7 @@ rewrite_heap_tuple(RewriteState state, { OldToNewMapping mapping; - memset(&hashkey, 0, sizeof(hashkey)); + memset(&hashkey, 0, sizeof(TidHashKey)); hashkey.xmin = HeapTupleHeaderGetUpdateXid(old_tuple->t_data); hashkey.tid = old_tuple->t_data->t_ctid; @@ -493,7 +493,7 @@ rewrite_heap_tuple(RewriteState state, */ UnresolvedTup unresolved; - memset(&hashkey, 0, sizeof(hashkey)); + memset(&hashkey, 0, sizeof(TidHashKey)); hashkey.xmin = HeapTupleHeaderGetXmin(new_tuple->t_data); hashkey.tid = old_tid; @@ -581,7 +581,7 @@ rewrite_heap_dead_tuple(RewriteState state, HeapTuple old_tuple) TidHashKey hashkey; bool found; - memset(&hashkey, 0, sizeof(hashkey)); + memset(&hashkey, 0, sizeof(TidHashKey)); hashkey.xmin = HeapTupleHeaderGetXmin(old_tuple->t_data); hashkey.tid = old_tuple->t_self; diff --git a/src/backend/access/spgist/spgdoinsert.c b/src/backend/access/spgist/spgdoinsert.c index e84b5edc03..6194a92542 100644 --- a/src/backend/access/spgist/spgdoinsert.c +++ b/src/backend/access/spgist/spgdoinsert.c @@ -818,7 +818,7 @@ doPickSplit(Relation index, SpGistState *state, oldLeafs[in.nTuples] = newLeafTuple; in.nTuples++; - memset(&out, 0, sizeof(out)); + memset(&out, 0, sizeof(spgPickSplitOut)); if (!isNulls) { @@ -2185,7 +2185,7 @@ spgdoinsert(Relation index, SpGistState *state, in.nNodes = innerTuple->nNodes; in.nodeLabels = spgExtractNodeLabels(state, innerTuple); - memset(&out, 0, sizeof(out)); + memset(&out, 0, sizeof(spgChooseOut)); if (!isnull) { diff --git a/src/backend/access/spgist/spgscan.c b/src/backend/access/spgist/spgscan.c index 87a345d290..888722f9e3 100644 --- a/src/backend/access/spgist/spgscan.c +++ b/src/backend/access/spgist/spgscan.c @@ -672,7 +672,7 @@ spgInnerTest(SpGistScanOpaque so, SpGistSearchItem *item, int nNodes = innerTuple->nNodes; int i; - memset(&out, 0, sizeof(out)); + memset(&out, 0, sizeof(spgInnerConsistentOut)); if (!isnull) { diff --git a/src/backend/access/spgist/spgvalidate.c b/src/backend/access/spgist/spgvalidate.c index 82281f7b83..5167f60454 100644 --- a/src/backend/access/spgist/spgvalidate.c +++ b/src/backend/access/spgist/spgvalidate.c @@ -112,7 +112,7 @@ spgvalidate(Oid opclassoid) ok = check_amproc_signature(procform->amproc, VOIDOID, true, 2, 2, INTERNALOID, INTERNALOID); configIn.attType = procform->amproclefttype; - memset(&configOut, 0, sizeof(configOut)); + memset(&configOut, 0, sizeof(spgConfigOut)); OidFunctionCall2(procform->amproc, PointerGetDatum(&configIn), diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c index df0cd77558..3575a17ed2 100644 --- a/src/backend/access/transam/parallel.c +++ b/src/backend/access/transam/parallel.c @@ -557,7 +557,7 @@ LaunchParallelWorkers(ParallelContext *pcxt) oldcontext = MemoryContextSwitchTo(TopTransactionContext); /* Configure a worker. */ - memset(&worker, 0, sizeof(worker)); + memset(&worker, 0, sizeof(BackgroundWorker)); snprintf(worker.bgw_name, BGW_MAXLEN, "parallel worker for PID %d", MyProcPid); snprintf(worker.bgw_type, BGW_MAXLEN, "parallel worker"); diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 71136b11a2..afb918f13b 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6302,7 +6302,7 @@ CreateCheckPoint(int flags) * checkpoint proceeds, we always accumulate stats, even if * log_checkpoints is currently off. */ - MemSet(&CheckpointStats, 0, sizeof(CheckpointStats)); + MemSet(&CheckpointStats, 0, sizeof(CheckpointStatsData)); CheckpointStats.ckpt_start_t = GetCurrentTimestamp(); /* @@ -6327,7 +6327,7 @@ CreateCheckPoint(int flags) } /* Begin filling in the checkpoint WAL record */ - MemSet(&checkPoint, 0, sizeof(checkPoint)); + MemSet(&checkPoint, 0, sizeof(CheckPoint)); checkPoint.time = (pg_time_t) time(NULL); /* @@ -6999,7 +6999,7 @@ CreateRestartPoint(int flags) * checkpoint proceeds, we always accumulate stats, even if * log_checkpoints is currently off. */ - MemSet(&CheckpointStats, 0, sizeof(CheckpointStats)); + MemSet(&CheckpointStats, 0, sizeof(CheckpointStatsData)); CheckpointStats.ckpt_start_t = GetCurrentTimestamp(); if (log_checkpoints) diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index de10923391..219dc21b28 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -572,8 +572,8 @@ findDependentObjects(const ObjectAddress *object, NULL, nkeys, key); /* initialize variables that loop may fill */ - memset(&owningObject, 0, sizeof(owningObject)); - memset(&partitionObject, 0, sizeof(partitionObject)); + memset(&owningObject, 0, sizeof(ObjectAddress)); + memset(&partitionObject, 0, sizeof(ObjectAddress)); while (HeapTupleIsValid(tup = systable_getnext(scan))) { @@ -997,7 +997,7 @@ findDependentObjects(const ObjectAddress *object, else if (stack) extra.dependee = *stack->object; else - memset(&extra.dependee, 0, sizeof(extra.dependee)); + memset(&extra.dependee, 0, sizeof(ObjectAddress)); add_exact_object_address_extra(object, &extra, targetObjects); } @@ -1640,7 +1640,7 @@ recordDependencyOnSingleRelExpr(const ObjectAddress *depender, context.addrs = new_object_addresses(); /* We gin up a rather bogus rangetable list to handle Vars */ - MemSet(&rte, 0, sizeof(rte)); + MemSet(&rte, 0, sizeof(RangeTblEntry)); rte.type = T_RangeTblEntry; rte.rtekind = RTE_RELATION; rte.relid = relId; diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 2da6b75a15..e9eeab9727 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -2394,7 +2394,7 @@ compute_scalar_stats(VacAttrStatsP stats, tupnoLink = (int *) palloc(samplerows * sizeof(int)); track = (ScalarMCVItem *) palloc(num_mcv * sizeof(ScalarMCVItem)); - memset(&ssup, 0, sizeof(ssup)); + memset(&ssup, 0, sizeof(SortSupportData)); ssup.ssup_cxt = CurrentMemoryContext; ssup.ssup_collation = stats->attrcollid; ssup.ssup_nulls_first = false; diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 2de0ebacec..5b837a0ee3 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -11508,7 +11508,7 @@ validateForeignKeyConstraint(char *conname, /* * Build a trigger call structure; we'll need it either way. */ - MemSet(&trig, 0, sizeof(trig)); + MemSet(&trig, 0, sizeof(Trigger)); trig.tgoid = InvalidOid; trig.tgname = conname; trig.tgenabled = TRIGGER_FIRES_ON_ORIGIN; @@ -19231,7 +19231,7 @@ ATDetachCheckNoForeignKeyRefs(Relation partition) /* prevent data changes into the referencing table until commit */ rel = table_open(constrForm->conrelid, ShareLock); - MemSet(&trig, 0, sizeof(trig)); + MemSet(&trig, 0, sizeof(Trigger)); trig.tgoid = InvalidOid; trig.tgname = NameStr(constrForm->conname); trig.tgenabled = TRIGGER_FIRES_ON_ORIGIN; diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 9b92b04242..a2d9904568 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -4119,7 +4119,7 @@ AlterType(AlterTypeStmt *stmt) typForm = (Form_pg_type) GETSTRUCT(tup); /* Process options */ - memset(&atparams, 0, sizeof(atparams)); + memset(&atparams, 0, sizeof(AlterTypeRecurseParams)); foreach(pl, stmt->options) { DefElem *defel = (DefElem *) lfirst(pl); @@ -4441,7 +4441,7 @@ AlterTypeRecurse(Oid typeOid, bool isImplicitArray, if (!HeapTupleIsValid(arrtup)) elog(ERROR, "cache lookup failed for type %u", arrtypoid); - memset(&arrparams, 0, sizeof(arrparams)); + memset(&arrparams, 0, sizeof(AlterTypeRecurseParams)); arrparams.updateTypmodin = atparams->updateTypmodin; arrparams.updateTypmodout = atparams->updateTypmodout; arrparams.typmodinOid = atparams->typmodinOid; diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c index 2831e7978b..a9d6cc4e07 100644 --- a/src/backend/executor/execExpr.c +++ b/src/backend/executor/execExpr.c @@ -3163,7 +3163,7 @@ ExecInitSubscriptingRef(ExprEvalStep *scratch, SubscriptingRef *sbsref, * execution steps below; and it can optionally set up some data pointed * to by the workspace field. */ - memset(&methods, 0, sizeof(methods)); + memset(&methods, 0, sizeof(SubscriptExecSteps)); sbsroutines->exec_setup(sbsref, sbsrefstate, &methods); /* diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index 29bc26669b..701ef3e132 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -611,7 +611,7 @@ SPI_execute(const char *src, bool read_only, long tcount) _SPI_prepare_oneshot_plan(src, &plan); - memset(&options, 0, sizeof(options)); + memset(&options, 0, sizeof(SPIExecuteOptions)); options.read_only = read_only; options.tcount = tcount; @@ -683,7 +683,7 @@ SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls, if (res < 0) return res; - memset(&options, 0, sizeof(options)); + memset(&options, 0, sizeof(SPIExecuteOptions)); options.params = _SPI_convert_params(plan->nargs, plan->argtypes, Values, Nulls); options.read_only = read_only; @@ -741,7 +741,7 @@ SPI_execute_plan_with_paramlist(SPIPlanPtr plan, ParamListInfo params, if (res < 0) return res; - memset(&options, 0, sizeof(options)); + memset(&options, 0, sizeof(SPIExecuteOptions)); options.params = params; options.read_only = read_only; options.tcount = tcount; @@ -786,7 +786,7 @@ SPI_execute_snapshot(SPIPlanPtr plan, if (res < 0) return res; - memset(&options, 0, sizeof(options)); + memset(&options, 0, sizeof(SPIExecuteOptions)); options.params = _SPI_convert_params(plan->nargs, plan->argtypes, Values, Nulls); options.read_only = read_only; @@ -841,7 +841,7 @@ SPI_execute_with_args(const char *src, _SPI_prepare_oneshot_plan(src, &plan); - memset(&options, 0, sizeof(options)); + memset(&options, 0, sizeof(SPIExecuteOptions)); options.params = paramLI; options.read_only = read_only; options.tcount = tcount; diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index efc53f3135..450ea73b22 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -3041,7 +3041,7 @@ PerformRadiusTransaction(const char *server, const char *secret, const char *por if (identifier == NULL) identifier = "postgresql"; - MemSet(&hint, 0, sizeof(hint)); + MemSet(&hint, 0, sizeof(struct addrinfo)); hint.ai_socktype = SOCK_DGRAM; hint.ai_family = AF_UNSPEC; port = atoi(portstr); @@ -3133,8 +3133,8 @@ PerformRadiusTransaction(const char *server, const char *secret, const char *por return STATUS_ERROR; } - memset(&localaddr, 0, sizeof(localaddr)); #ifdef HAVE_IPV6 + memset(&localaddr, 0, sizeof(struct sockaddr_in6)); localaddr.sin6_family = serveraddrs[0].ai_family; localaddr.sin6_addr = in6addr_any; if (localaddr.sin6_family == AF_INET6) @@ -3142,6 +3142,7 @@ PerformRadiusTransaction(const char *server, const char *secret, const char *por else addrsize = sizeof(struct sockaddr_in); #else + memset(&localaddr, 0, sizeof(struct sockaddr_in)); localaddr.sin_family = serveraddrs[0].ai_family; localaddr.sin_addr.s_addr = INADDR_ANY; addrsize = sizeof(struct sockaddr_in); diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 327a4b42af..eb67505180 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -1964,7 +1964,7 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, /* For each entry in the list, translate it */ foreach(l, parsed_servers) { - MemSet(&hints, 0, sizeof(hints)); + MemSet(&hints, 0, sizeof(struct addrinfo)); hints.ai_socktype = SOCK_DGRAM; hints.ai_family = AF_UNSPEC; diff --git a/src/backend/libpq/ifaddr.c b/src/backend/libpq/ifaddr.c index a41808aff0..346620ef33 100644 --- a/src/backend/libpq/ifaddr.c +++ b/src/backend/libpq/ifaddr.c @@ -137,7 +137,7 @@ pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family) if (bits < 0 || bits > 32) return -1; - memset(&mask4, 0, sizeof(mask4)); + memset(&mask4, 0, sizeof(struct sockaddr_in)); /* avoid "x << 32", which is not portable */ if (bits > 0) maskl = (0xffffffffUL << (32 - (int) bits)) @@ -157,7 +157,7 @@ pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family) if (bits < 0 || bits > 128) return -1; - memset(&mask6, 0, sizeof(mask6)); + memset(&mask6, 0, sizeof(struct sockaddr_in6)); for (i = 0; i < 16; i++) { if (bits <= 0) @@ -387,7 +387,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) return -1; } - memset(&lifc, 0, sizeof(lifc)); + memset(&lifc, 0, sizeof(struct lifconf)); lifc.lifc_family = AF_UNSPEC; lifc.lifc_buf = buffer = ptr; lifc.lifc_len = n_buffer; @@ -508,7 +508,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) return -1; } - memset(&ifc, 0, sizeof(ifc)); + memset(&ifc, 0, sizeof(struct ifconf)); ifc.ifc_buf = buffer = ptr; ifc.ifc_len = n_buffer; @@ -566,10 +566,10 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) #endif /* addr 127.0.0.1/8 */ - memset(&addr, 0, sizeof(addr)); + memset(&addr, 0, sizeof(struct sockaddr_in)); addr.sin_family = AF_INET; addr.sin_addr.s_addr = pg_ntoh32(0x7f000001); - memset(&mask, 0, sizeof(mask)); + memset(&mask, 0, sizeof(struct sockaddr_storage)); pg_sockaddr_cidr_mask(&mask, "8", AF_INET); run_ifaddr_callback(callback, cb_data, (struct sockaddr *) &addr, @@ -577,10 +577,10 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) #ifdef HAVE_IPV6 /* addr ::1/128 */ - memset(&addr6, 0, sizeof(addr6)); + memset(&addr6, 0, sizeof(struct sockaddr_in6)); addr6.sin6_family = AF_INET6; addr6.sin6_addr.s6_addr[15] = 1; - memset(&mask, 0, sizeof(mask)); + memset(&mask, 0, sizeof(struct sockaddr_storage)); pg_sockaddr_cidr_mask(&mask, "128", AF_INET6); run_ifaddr_callback(callback, cb_data, (struct sockaddr *) &addr6, diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index 75392a8bb7..ed041b79eb 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -343,7 +343,7 @@ StreamServerPort(int family, const char *hostName, unsigned short portNumber, #endif /* Initialize hint structure */ - MemSet(&hint, 0, sizeof(hint)); + MemSet(&hint, 0, sizeof(struct addrinfo)); hint.ai_family = family; hint.ai_flags = AI_PASSIVE; hint.ai_socktype = SOCK_STREAM; diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 7ac116a791..77f1d0665f 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -2467,7 +2467,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel, * will be set true if we find that output column i of the subquery is * unsafe to use in a pushed-down qual. */ - memset(&safetyInfo, 0, sizeof(safetyInfo)); + memset(&safetyInfo, 0, sizeof(pushdown_safety_info)); safetyInfo.unsafeColumns = (bool *) palloc0((list_length(subquery->targetList) + 1) * sizeof(bool)); diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 0ef70ad7f1..f78d38e019 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -269,7 +269,7 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel) /* * Identify the restriction clauses that can match the index. */ - MemSet(&rclauseset, 0, sizeof(rclauseset)); + MemSet(&rclauseset, 0, sizeof(IndexClauseSet)); match_restriction_clauses_to_index(root, index, &rclauseset); /* @@ -286,7 +286,7 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel) * step finds only "loose" join clauses that have not been merged into * EquivalenceClasses. Also, collect join OR clauses for later. */ - MemSet(&jclauseset, 0, sizeof(jclauseset)); + MemSet(&jclauseset, 0, sizeof(IndexClauseSet)); match_join_clauses_to_index(root, rel, index, &jclauseset, &joinorclauses); @@ -294,7 +294,7 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel) * Look for EquivalenceClasses that can generate joinclauses matching * the index. */ - MemSet(&eclauseset, 0, sizeof(eclauseset)); + MemSet(&eclauseset, 0, sizeof(IndexClauseSet)); match_eclass_clauses_to_index(root, index, &eclauseset); @@ -616,7 +616,7 @@ get_join_index_paths(PlannerInfo *root, RelOptInfo *rel, return; /* Identify indexclauses usable with this relids set */ - MemSet(&clauseset, 0, sizeof(clauseset)); + MemSet(&clauseset, 0, sizeof(IndexClauseSet)); for (indexcol = 0; indexcol < index->nkeycolumns; indexcol++) { @@ -1211,7 +1211,7 @@ build_paths_for_OR(PlannerInfo *root, RelOptInfo *rel, /* * Identify the restriction clauses that can match the index. */ - MemSet(&clauseset, 0, sizeof(clauseset)); + MemSet(&clauseset, 0, sizeof(IndexClauseSet)); match_clauses_to_index(root, clauses, index, &clauseset); /* diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index a0f2390334..598bf3960a 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -5915,12 +5915,12 @@ expression_planner_with_deps(Expr *expr, PlannerInfo root; /* Make up dummy planner state so we can use setrefs machinery */ - MemSet(&glob, 0, sizeof(glob)); + MemSet(&glob, 0, sizeof(PlannerGlobal)); glob.type = T_PlannerGlobal; glob.relationOids = NIL; glob.invalItems = NIL; - MemSet(&root, 0, sizeof(root)); + MemSet(&root, 0, sizeof(PlannerInfo)); root.type = T_PlannerInfo; root.glob = &glob; diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index d95fd89807..eabeacb0e5 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -3274,14 +3274,14 @@ extract_query_dependencies(Node *query, PlannerInfo root; /* Make up dummy planner state so we can use this module's machinery */ - MemSet(&glob, 0, sizeof(glob)); + MemSet(&glob, 0, sizeof(PlannerGlobal)); glob.type = T_PlannerGlobal; glob.relationOids = NIL; glob.invalItems = NIL; /* Hack: we use glob.dependsOnRole to collect hasRowSecurity flags */ glob.dependsOnRole = false; - MemSet(&root, 0, sizeof(root)); + MemSet(&root, 0, sizeof(PlannerInfo)); root.type = T_PlannerInfo; root.glob = &glob; diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index 2a1d44b813..375714154a 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -1596,7 +1596,7 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup) */ ParseState mypstate; - MemSet(&mypstate, 0, sizeof(mypstate)); + MemSet(&mypstate, 0, sizeof(ParseState)); mypstate.parentParseState = pstate; mypstate.p_rtable = rte->subquery->rtable; /* don't bother filling the rest of the fake pstate */ @@ -1652,7 +1652,7 @@ expandRecordVariable(ParseState *pstate, Var *var, int levelsup) ParseState mypstate; Index levelsup; - MemSet(&mypstate, 0, sizeof(mypstate)); + MemSet(&mypstate, 0, sizeof(ParseState)); /* this loop must work, since GetCTEForRTE did */ for (levelsup = 0; levelsup < rte->ctelevelsup + netlevelsup; diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 3b73e26956..76ba287da4 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -4525,7 +4525,7 @@ postmaster_forkexec(int argc, char *argv[]) Port port; /* This entry point passes dummy values for the Port variables */ - memset(&port, 0, sizeof(port)); + memset(&port, 0, sizeof(Port)); return internal_forkexec(argc, argv, &port); } diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c index bd5f78cf9a..14014461a1 100644 --- a/src/backend/replication/logical/launcher.c +++ b/src/backend/replication/logical/launcher.c @@ -391,7 +391,7 @@ retry: LWLockRelease(LogicalRepWorkerLock); /* Register the new dynamic worker. */ - memset(&bgw, 0, sizeof(bgw)); + memset(&bgw, 0, sizeof(BackgroundWorker)); bgw.bgw_flags = BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION; bgw.bgw_start_time = BgWorkerStart_RecoveryFinished; @@ -710,7 +710,7 @@ ApplyLauncherRegister(void) if (max_logical_replication_workers == 0) return; - memset(&bgw, 0, sizeof(bgw)); + memset(&bgw, 0, sizeof(BackgroundWorker)); bgw.bgw_flags = BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION; bgw.bgw_start_time = BgWorkerStart_RecoveryFinished; diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c index 21937ab2d3..524b880f78 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -615,7 +615,7 @@ CheckPointReplicationOrigin(void) continue; /* zero, to avoid uninitialized padding bytes */ - memset(&disk_state, 0, sizeof(disk_state)); + memset(&disk_state, 0, sizeof(ReplicationStateOnDisk)); LWLockAcquire(&curstate->lock, LW_SHARED); diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 8da5f9089c..628087c417 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -314,7 +314,7 @@ ReorderBufferAllocate(void) buffer = (ReorderBuffer *) MemoryContextAlloc(new_ctx, sizeof(ReorderBuffer)); - memset(&hash_ctl, 0, sizeof(hash_ctl)); + memset(&hash_ctl, 0, sizeof(HASHCTL)); buffer->context = new_ctx; @@ -4740,7 +4740,7 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn, else SET_VARSIZE(reconstructed, data_done + VARHDRSZ); - memset(&redirect_pointer, 0, sizeof(redirect_pointer)); + memset(&redirect_pointer, 0, sizeof(struct varatt_indirect)); redirect_pointer.pointer = reconstructed; SET_VARTAG_EXTERNAL(new_datum, VARTAG_INDIRECT); @@ -5115,7 +5115,7 @@ ResolveCminCmaxDuringDecoding(HTAB *tuplecid_data, return false; /* be careful about padding */ - memset(&key, 0, sizeof(key)); + memset(&key, 0, sizeof(ReorderBufferTupleCidKey)); Assert(!BufferIsLocal(buffer)); diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c index 671b00a33c..42a6f5ee91 100644 --- a/src/backend/storage/ipc/standby.c +++ b/src/backend/storage/ipc/standby.c @@ -1402,7 +1402,7 @@ LogStandbyInvalidations(int nmsgs, SharedInvalidationMessage *msgs, xl_invalidations xlrec; /* prepare record */ - memset(&xlrec, 0, sizeof(xlrec)); + memset(&xlrec, 0, sizeof(xl_invalidations)); xlrec.dbId = MyDatabaseId; xlrec.tsId = MyDatabaseTableSpace; xlrec.relcacheInitFileInval = relcacheInitFileInval; diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index 5f5803f681..62f670f5d0 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -603,7 +603,7 @@ LockHeldByMe(const LOCKTAG *locktag, LOCKMODE lockmode) /* * See if there is a LOCALLOCK entry for this lock and lockmode */ - MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ + MemSet(&localtag, 0, sizeof(LOCALLOCKTAG)); /* must clear padding */ localtag.lock = *locktag; localtag.mode = lockmode; @@ -658,7 +658,7 @@ LockHasWaiters(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) /* * Find the LOCALLOCK entry for this lock and lockmode */ - MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ + MemSet(&localtag, 0, sizeof(LOCALLOCKTAG)); /* must clear padding */ localtag.lock = *locktag; localtag.mode = lockmode; @@ -820,7 +820,7 @@ LockAcquireExtended(const LOCKTAG *locktag, /* * Find or create a LOCALLOCK entry for this lock and lockmode */ - MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ + MemSet(&localtag, 0, sizeof(LOCALLOCKTAG)); /* must clear padding */ localtag.lock = *locktag; localtag.mode = lockmode; @@ -1999,7 +1999,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) /* * Find the LOCALLOCK entry for this lock and lockmode */ - MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ + MemSet(&localtag, 0, sizeof(LOCALLOCKTAG)); /* must clear padding */ localtag.lock = *locktag; localtag.mode = lockmode; diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index 8aef909037..6b56fc345d 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -397,7 +397,7 @@ get_lwlock_stats_entry(LWLock *lock) return &lwlock_stats_dummy; /* Fetch or create the entry. */ - MemSet(&key, 0, sizeof(key)); + MemSet(&key, 0, sizeof(lwlock_stats_key)); key.tranche = lock->tranche; key.instance = lock; lwstats = hash_search(lwlock_stats_htab, &key, HASH_ENTER, &found); diff --git a/src/backend/utils/activity/backend_status.c b/src/backend/utils/activity/backend_status.c index c7ed1e6d7a..f49ee51384 100644 --- a/src/backend/utils/activity/backend_status.c +++ b/src/backend/utils/activity/backend_status.c @@ -320,10 +320,10 @@ pgstat_bestart(void) /* These structs can just start from zeroes each time, though */ #ifdef USE_SSL - memset(&lsslstatus, 0, sizeof(lsslstatus)); + memset(&lsslstatus, 0, sizeof(PgBackendSSLStatus)); #endif #ifdef ENABLE_GSS - memset(&lgssstatus, 0, sizeof(lgssstatus)); + memset(&lgssstatus, 0, sizeof(PgBackendGSSStatus)); #endif /* @@ -353,9 +353,9 @@ pgstat_bestart(void) */ if (MyProcPort) memcpy(&lbeentry.st_clientaddr, &MyProcPort->raddr, - sizeof(lbeentry.st_clientaddr)); + sizeof(SockAddr)); else - MemSet(&lbeentry.st_clientaddr, 0, sizeof(lbeentry.st_clientaddr)); + MemSet(&lbeentry.st_clientaddr, 0, sizeof(SockAddr)); #ifdef USE_SSL if (MyProcPort && MyProcPort->ssl_in_use) diff --git a/src/backend/utils/activity/pgstat_replslot.c b/src/backend/utils/activity/pgstat_replslot.c index b77c05ab5f..59794eb378 100644 --- a/src/backend/utils/activity/pgstat_replslot.c +++ b/src/backend/utils/activity/pgstat_replslot.c @@ -123,7 +123,7 @@ pgstat_create_replslot(ReplicationSlot *slot) * NB: need to accept that there might be stats from an older slot, e.g. * if we previously crashed after dropping a slot. */ - memset(&shstatent->stats, 0, sizeof(shstatent->stats)); + memset(&shstatent->stats, 0, sizeof(PgStat_StatReplSlotEntry)); namestrcpy(&shstatent->stats.slotname, NameStr(slot->data.name)); pgstat_unlock_entry(entry_ref); diff --git a/src/backend/utils/activity/pgstat_wal.c b/src/backend/utils/activity/pgstat_wal.c index 5a878bd115..993aedf460 100644 --- a/src/backend/utils/activity/pgstat_wal.c +++ b/src/backend/utils/activity/pgstat_wal.c @@ -154,7 +154,7 @@ pgstat_wal_reset_all_cb(TimestampTz ts) PgStatShared_Wal *stats_shmem = &pgStatLocal.shmem->wal; LWLockAcquire(&stats_shmem->lock, LW_EXCLUSIVE); - memset(&stats_shmem->stats, 0, sizeof(stats_shmem->stats)); + memset(&stats_shmem->stats, 0, sizeof(PgStat_WalStats)); stats_shmem->stats.stat_reset_timestamp = ts; LWLockRelease(&stats_shmem->lock); } diff --git a/src/backend/utils/adt/array_selfuncs.c b/src/backend/utils/adt/array_selfuncs.c index 8cbee1406b..b916d41c20 100644 --- a/src/backend/utils/adt/array_selfuncs.c +++ b/src/backend/utils/adt/array_selfuncs.c @@ -151,7 +151,7 @@ scalararraysel_containment(PlannerInfo *root, !get_attstatsslot(&hslot, vardata.statsTuple, STATISTIC_KIND_DECHIST, InvalidOid, ATTSTATSSLOT_NUMBERS)) - memset(&hslot, 0, sizeof(hslot)); + memset(&hslot, 0, sizeof(AttStatsSlot)); /* * For = ANY, estimate as var @> ARRAY[const]. @@ -377,7 +377,7 @@ calc_arraycontsel(VariableStatData *vardata, Datum constval, !get_attstatsslot(&hslot, vardata->statsTuple, STATISTIC_KIND_DECHIST, InvalidOid, ATTSTATSSLOT_NUMBERS)) - memset(&hslot, 0, sizeof(hslot)); + memset(&hslot, 0, sizeof(AttStatsSlot)); /* Use the most-common-elements slot for the array Var. */ selec = mcelem_array_selec(array, typentry, diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c index 553cc25eb9..529c2352b6 100644 --- a/src/backend/utils/adt/json.c +++ b/src/backend/utils/adt/json.c @@ -966,7 +966,7 @@ json_unique_check_init(JsonUniqueCheckState *cxt) { HASHCTL ctl; - memset(&ctl, 0, sizeof(ctl)); + memset(&ctl, 0, sizeof(HASHCTL)); ctl.keysize = sizeof(JsonUniqueHashEntry); ctl.entrysize = sizeof(JsonUniqueHashEntry); ctl.hcxt = CurrentMemoryContext; @@ -1058,7 +1058,7 @@ json_object_agg_transfn_worker(FunctionCallInfo fcinfo, if (unique_keys) json_unique_builder_init(&state->unique_check); else - memset(&state->unique_check, 0, sizeof(state->unique_check)); + memset(&state->unique_check, 0, sizeof(JsonUniqueBuilderState)); MemoryContextSwitchTo(oldcontext); arg_type = get_fn_expr_argtype(fcinfo->flinfo, 1); diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c index 39355e242d..a09c632c86 100644 --- a/src/backend/utils/adt/jsonb.c +++ b/src/backend/utils/adt/jsonb.c @@ -246,8 +246,8 @@ jsonb_from_cstring(char *json, int len, bool unique_keys) JsonbInState state; JsonSemAction sem; - memset(&state, 0, sizeof(state)); - memset(&sem, 0, sizeof(sem)); + memset(&state, 0, sizeof(JsonbInState)); + memset(&sem, 0, sizeof(JsonSemAction)); lex = makeJsonLexContextCstringLen(json, len, GetDatabaseEncoding(), true); state.unique_keys = unique_keys; @@ -839,7 +839,7 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result, lex = makeJsonLexContext(json, true); - memset(&sem, 0, sizeof(sem)); + memset(&sem, 0, sizeof(JsonSemAction)); sem.semstate = (void *) result; diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index d427bdfbe0..87c6431b33 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -2625,7 +2625,7 @@ populate_array_json(PopulateArrayContext *ctx, char *json, int len) state.lex = makeJsonLexContextCstringLen(json, len, GetDatabaseEncoding(), true); state.ctx = ctx; - memset(&sem, 0, sizeof(sem)); + memset(&sem, 0, sizeof(JsonSemAction)); sem.semstate = (void *) &state; sem.object_start = populate_array_object_start; sem.array_end = populate_array_array_end; diff --git a/src/backend/utils/adt/mcxtfuncs.c b/src/backend/utils/adt/mcxtfuncs.c index bb7cc94024..b7f832ccb5 100644 --- a/src/backend/utils/adt/mcxtfuncs.c +++ b/src/backend/utils/adt/mcxtfuncs.c @@ -62,7 +62,7 @@ PutMemoryContextsStatsTupleStore(Tuplestorestate *tupstore, } /* Examine the context itself */ - memset(&stat, 0, sizeof(stat)); + memset(&stat, 0, sizeof(MemoryContextCounters)); (*context->methods->stats) (context, NULL, (void *) &level, &stat, true); memset(values, 0, sizeof(values)); diff --git a/src/backend/utils/adt/multirangetypes_selfuncs.c b/src/backend/utils/adt/multirangetypes_selfuncs.c index 919c8889d4..9a74c542ba 100644 --- a/src/backend/utils/adt/multirangetypes_selfuncs.c +++ b/src/backend/utils/adt/multirangetypes_selfuncs.c @@ -535,7 +535,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata, } } else - memset(&lslot, 0, sizeof(lslot)); + memset(&lslot, 0, sizeof(AttStatsSlot)); /* Extract the bounds of the constant value. */ Assert(constval->rangeCount > 0); diff --git a/src/backend/utils/adt/network_selfuncs.c b/src/backend/utils/adt/network_selfuncs.c index 49196376a8..a34e74d97e 100644 --- a/src/backend/utils/adt/network_selfuncs.c +++ b/src/backend/utils/adt/network_selfuncs.c @@ -299,8 +299,8 @@ networkjoinsel_inner(Oid operator, } else { - memset(&mcv1_slot, 0, sizeof(mcv1_slot)); - memset(&hist1_slot, 0, sizeof(hist1_slot)); + memset(&mcv1_slot, 0, sizeof(AttStatsSlot)); + memset(&hist1_slot, 0, sizeof(AttStatsSlot)); } if (HeapTupleIsValid(vardata2->statsTuple)) @@ -321,8 +321,8 @@ networkjoinsel_inner(Oid operator, } else { - memset(&mcv2_slot, 0, sizeof(mcv2_slot)); - memset(&hist2_slot, 0, sizeof(hist2_slot)); + memset(&mcv2_slot, 0, sizeof(AttStatsSlot)); + memset(&hist2_slot, 0, sizeof(AttStatsSlot)); } opr_codenum = inet_opr_codenum(operator); @@ -429,8 +429,8 @@ networkjoinsel_semi(Oid operator, } else { - memset(&mcv1_slot, 0, sizeof(mcv1_slot)); - memset(&hist1_slot, 0, sizeof(hist1_slot)); + memset(&mcv1_slot, 0, sizeof(AttStatsSlot)); + memset(&hist1_slot, 0, sizeof(AttStatsSlot)); } if (HeapTupleIsValid(vardata2->statsTuple)) @@ -451,8 +451,8 @@ networkjoinsel_semi(Oid operator, } else { - memset(&mcv2_slot, 0, sizeof(mcv2_slot)); - memset(&hist2_slot, 0, sizeof(hist2_slot)); + memset(&mcv2_slot, 0, sizeof(AttStatsSlot)); + memset(&hist2_slot, 0, sizeof(AttStatsSlot)); } opr_codenum = inet_opr_codenum(operator); diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index a0490a7522..5262b47902 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -497,7 +497,7 @@ PGLC_localeconv(void) * allocated with strdup, to avoid premature elog(ERROR) and to allow * using a single cleanup routine. */ - memset(&worklconv, 0, sizeof(worklconv)); + memset(&worklconv, 0, sizeof(struct lconv)); /* Save prevailing values of monetary and numeric locales */ save_lc_monetary = setlocale(LC_MONETARY, NULL); @@ -1548,7 +1548,7 @@ pg_newlocale_from_collation(Oid collid) collform = (Form_pg_collation) GETSTRUCT(tp); /* We'll fill in the result struct locally before allocating memory */ - memset(&result, 0, sizeof(result)); + memset(&result, 0, sizeof(struct pg_locale_struct)); result.provider = collform->collprovider; result.deterministic = collform->collisdeterministic; diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index 893690dad5..1828c2e0fe 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -731,7 +731,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) nulls[11] = true; /* A zeroed client addr means we don't know */ - memset(&zero_clientaddr, 0, sizeof(zero_clientaddr)); + memset(&zero_clientaddr, 0, sizeof(SockAddr)); if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr, sizeof(zero_clientaddr)) == 0) { @@ -1103,7 +1103,7 @@ pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS) PG_RETURN_NULL(); /* A zeroed client addr means we don't know */ - memset(&zero_clientaddr, 0, sizeof(zero_clientaddr)); + memset(&zero_clientaddr, 0, sizeof(SockAddr)); if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr, sizeof(zero_clientaddr)) == 0) PG_RETURN_NULL(); @@ -1150,7 +1150,7 @@ pg_stat_get_backend_client_port(PG_FUNCTION_ARGS) PG_RETURN_NULL(); /* A zeroed client addr means we don't know */ - memset(&zero_clientaddr, 0, sizeof(zero_clientaddr)); + memset(&zero_clientaddr, 0, sizeof(SockAddr)); if (memcmp(&(beentry->st_clientaddr), &zero_clientaddr, sizeof(zero_clientaddr)) == 0) PG_RETURN_NULL(); diff --git a/src/backend/utils/adt/rangetypes_selfuncs.c b/src/backend/utils/adt/rangetypes_selfuncs.c index c2795f4593..9222381181 100644 --- a/src/backend/utils/adt/rangetypes_selfuncs.c +++ b/src/backend/utils/adt/rangetypes_selfuncs.c @@ -446,7 +446,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata, } } else - memset(&lslot, 0, sizeof(lslot)); + memset(&lslot, 0, sizeof(AttStatsSlot)); /* Extract the bounds of the constant value. */ range_deserialize(typcache, constval, &const_lower, &const_upper, &empty); diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 49c4201dde..50fb6542ec 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -1057,7 +1057,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) newrte->inFromCl = true; /* Build two-element rtable */ - memset(&dpns, 0, sizeof(dpns)); + memset(&dpns, 0, sizeof(deparse_namespace)); dpns.rtable = list_make2(oldrte, newrte); dpns.subplans = NIL; dpns.ctes = NIL; @@ -3804,7 +3804,7 @@ select_rtable_names_for_explain(List *rtable, Bitmapset *rels_used) { deparse_namespace dpns; - memset(&dpns, 0, sizeof(dpns)); + memset(&dpns, 0, sizeof(deparse_namespace)); dpns.rtable = rtable; dpns.subplans = NIL; dpns.ctes = NIL; diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index fa1f589fad..0dec93f440 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -2271,8 +2271,8 @@ eqjoinsel(PG_FUNCTION_ARGS) opfuncoid = get_opcode(operator); - memset(&sslot1, 0, sizeof(sslot1)); - memset(&sslot2, 0, sizeof(sslot2)); + memset(&sslot1, 0, sizeof(AttStatsSlot)); + memset(&sslot2, 0, sizeof(AttStatsSlot)); if (HeapTupleIsValid(vardata1.statsTuple)) { @@ -6797,7 +6797,7 @@ btcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, /* * Now do generic index cost estimation. */ - MemSet(&costs, 0, sizeof(costs)); + MemSet(&costs, 0, sizeof(GenericCosts)); costs.numIndexTuples = numIndexTuples; genericcostestimate(root, path, loop_count, &costs); @@ -6842,7 +6842,7 @@ btcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, * ordering, but don't negate it entirely. Before 8.0 we divided the * correlation by the number of columns, but that seems too strong.) */ - MemSet(&vardata, 0, sizeof(vardata)); + MemSet(&vardata, 0, sizeof(VariableStatData)); if (index->indexkeys[0] != 0) { @@ -6949,7 +6949,7 @@ hashcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, { GenericCosts costs; - MemSet(&costs, 0, sizeof(costs)); + MemSet(&costs, 0, sizeof(GenericCosts)); genericcostestimate(root, path, loop_count, &costs); @@ -6995,7 +6995,7 @@ gistcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, GenericCosts costs; Cost descentCost; - MemSet(&costs, 0, sizeof(costs)); + MemSet(&costs, 0, sizeof(GenericCosts)); genericcostestimate(root, path, loop_count, &costs); @@ -7052,7 +7052,7 @@ spgcostestimate(PlannerInfo *root, IndexPath *path, double loop_count, GenericCosts costs; Cost descentCost; - MemSet(&costs, 0, sizeof(costs)); + MemSet(&costs, 0, sizeof(GenericCosts)); genericcostestimate(root, path, loop_count, &costs); @@ -7339,7 +7339,7 @@ gincost_scalararrayopexpr(PlannerInfo *root, elmlen, elmbyval, elmalign, &elemValues, &elemNulls, &numElems); - memset(&arraycounts, 0, sizeof(arraycounts)); + memset(&arraycounts, 0, sizeof(GinQualCounts)); for (i = 0; i < numElems; i++) { @@ -7350,7 +7350,7 @@ gincost_scalararrayopexpr(PlannerInfo *root, continue; /* Otherwise, apply extractQuery and get the actual term counts */ - memset(&elemcounts, 0, sizeof(elemcounts)); + memset(&elemcounts, 0, sizeof(GinQualCounts)); if (gincost_pattern(index, indexcol, clause_op, elemValues[i], &elemcounts)) @@ -7443,7 +7443,7 @@ gincostestimate(PlannerInfo *root, IndexPath *path, double loop_count, } else { - memset(&ginStats, 0, sizeof(ginStats)); + memset(&ginStats, 0, sizeof(GinStatsData)); } /* @@ -7532,7 +7532,7 @@ gincostestimate(PlannerInfo *root, IndexPath *path, double loop_count, /* * Examine quals to estimate number of search entries & partial matches */ - memset(&counts, 0, sizeof(counts)); + memset(&counts, 0, sizeof(GinQualCounts)); counts.arrayScans = 1; matchPossible = true; diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index addc349151..9394a02ba2 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -1671,8 +1671,8 @@ TS_phrase_execute(QueryItem *curitem, void *arg, uint32 flags, case OP_PHRASE: case OP_AND: - memset(&Ldata, 0, sizeof(Ldata)); - memset(&Rdata, 0, sizeof(Rdata)); + memset(&Ldata, 0, sizeof(ExecPhraseData)); + memset(&Rdata, 0, sizeof(ExecPhraseData)); lmatch = TS_phrase_execute(curitem + curitem->qoperator.left, arg, flags, chkcond, &Ldata); @@ -1753,8 +1753,8 @@ TS_phrase_execute(QueryItem *curitem, void *arg, uint32 flags, } case OP_OR: - memset(&Ldata, 0, sizeof(Ldata)); - memset(&Rdata, 0, sizeof(Rdata)); + memset(&Ldata, 0, sizeof(ExecPhraseData)); + memset(&Rdata, 0, sizeof(ExecPhraseData)); lmatch = TS_phrase_execute(curitem + curitem->qoperator.left, arg, flags, chkcond, &Ldata); diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index 919138eaf3..40d4bbb48a 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -4775,7 +4775,7 @@ text_to_array(PG_FUNCTION_ARGS) SplitTextOutputData tstate; /* For array output, tstate should start as all zeroes */ - memset(&tstate, 0, sizeof(tstate)); + memset(&tstate, 0, sizeof(SplitTextOutputData)); if (!split_text(fcinfo, &tstate)) PG_RETURN_NULL(); diff --git a/src/backend/utils/cache/attoptcache.c b/src/backend/utils/cache/attoptcache.c index 9e252a0891..ce4c66962f 100644 --- a/src/backend/utils/cache/attoptcache.c +++ b/src/backend/utils/cache/attoptcache.c @@ -110,7 +110,7 @@ get_attribute_options(Oid attrelid, int attnum) /* Find existing cache entry, if any. */ if (!AttoptCacheHash) InitializeAttoptCache(); - memset(&key, 0, sizeof(key)); /* make sure any padding bits are unset */ + memset(&key, 0, sizeof(AttoptCacheKey)); /* make sure any padding bits are unset */ key.attrelid = attrelid; key.attnum = attnum; attopt = diff --git a/src/backend/utils/cache/relfilenodemap.c b/src/backend/utils/cache/relfilenodemap.c index 70c323c720..266d9aef5e 100644 --- a/src/backend/utils/cache/relfilenodemap.c +++ b/src/backend/utils/cache/relfilenodemap.c @@ -153,7 +153,7 @@ RelidByRelfilenode(Oid reltablespace, Oid relfilenode) if (reltablespace == MyDatabaseTableSpace) reltablespace = 0; - MemSet(&key, 0, sizeof(key)); + MemSet(&key, 0, sizeof(RelfilenodeMapKey)); key.reltablespace = reltablespace; key.relfilenode = relfilenode; diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c index 9197b0f1e2..6c49d4f948 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -776,8 +776,8 @@ resolve_polymorphic_tupdesc(TupleDesc tupdesc, oidvector *declared_args, if (!call_expr) return false; /* no hope */ - memset(&poly_actuals, 0, sizeof(poly_actuals)); - memset(&anyc_actuals, 0, sizeof(anyc_actuals)); + memset(&poly_actuals, 0, sizeof(polymorphic_actuals)); + memset(&anyc_actuals, 0, sizeof(polymorphic_actuals)); for (i = 0; i < nargs; i++) { @@ -1041,8 +1041,8 @@ resolve_polymorphic_argtypes(int numargs, Oid *argtypes, char *argmodes, * resolve_polymorphic_tupdesc, we rely on the parser to have enforced * type consistency and coerced ANYCOMPATIBLE args to a common supertype. */ - memset(&poly_actuals, 0, sizeof(poly_actuals)); - memset(&anyc_actuals, 0, sizeof(anyc_actuals)); + memset(&poly_actuals, 0, sizeof(polymorphic_actuals)); + memset(&anyc_actuals, 0, sizeof(polymorphic_actuals)); inargno = 0; for (i = 0; i < numargs; i++) { diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index e12be1b9bd..76ec50e5dc 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -522,7 +522,7 @@ MemoryContextStatsDetail(MemoryContext context, int max_children, { MemoryContextCounters grand_totals; - memset(&grand_totals, 0, sizeof(grand_totals)); + memset(&grand_totals, 0, sizeof(MemoryContextCounters)); MemoryContextStatsInternal(context, 0, true, max_children, &grand_totals, print_to_stderr); @@ -582,7 +582,7 @@ MemoryContextStatsInternal(MemoryContext context, int level, * Examine children. If there are more than max_children of them, we do * not print the rest explicitly, but just summarize them. */ - memset(&local_totals, 0, sizeof(local_totals)); + memset(&local_totals, 0, sizeof(MemoryContextCounters)); for (child = context->firstchild, ichild = 0; child != NULL; diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index 5bc2a15160..84aecf64ec 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -1462,7 +1462,7 @@ ImportSnapshot(const char *idstr) /* * Construct a snapshot struct by parsing the file content. */ - memset(&snapshot, 0, sizeof(snapshot)); + memset(&snapshot, 0, sizeof(SnapshotData)); parseVxidFromText("vxid:", &filebuf, path, &src_vxid); src_pid = parseIntFromText("pid:", &filebuf, path); diff --git a/src/bin/initdb/findtimezone.c b/src/bin/initdb/findtimezone.c index ddb65e6489..7ff01ffef6 100644 --- a/src/bin/initdb/findtimezone.c +++ b/src/bin/initdb/findtimezone.c @@ -191,7 +191,7 @@ build_time_t(int year, int month, int day) { struct tm tm; - memset(&tm, 0, sizeof(tm)); + memset(&tm, 0, sizeof(struct tm)); tm.tm_mday = day; tm.tm_mon = month - 1; tm.tm_year = year - 1900; diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index ed6de7ca94..547efef1df 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1959,7 +1959,7 @@ locale_date_order(const char *locale) setlocale(LC_TIME, locale); - memset(&testtime, 0, sizeof(testtime)); + memset(&testtime, 0, sizeof(struct tm)); testtime.tm_mday = 22; testtime.tm_mon = 10; /* November, should come out as "11" */ testtime.tm_year = 133; /* 2033 */ diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 4adb170d46..56aed21433 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -457,7 +457,7 @@ reached_end_position(XLogRecPtr segendpos, uint32 timeline, FD_ZERO(&fds); FD_SET(bgpipe[0], &fds); - MemSet(&tv, 0, sizeof(tv)); + MemSet(&tv, 0, sizeof(struct timeval)); r = select(bgpipe[0] + 1, &fds, NULL, NULL, &tv); if (r == 1) @@ -532,7 +532,7 @@ LogStreamerMain(logstreamer_param *param) in_log_streamer = true; - MemSet(&stream, 0, sizeof(stream)); + MemSet(&stream, 0, sizeof(StreamCtl)); stream.startpos = param->startptr; stream.timeline = param->timeline; stream.sysidentifier = param->sysidentifier; @@ -1293,7 +1293,7 @@ ReceiveArchiveStream(PGconn *conn, pg_compress_specification *compress) ArchiveStreamState state; /* Set up initial state. */ - memset(&state, 0, sizeof(state)); + memset(&state, 0, sizeof(ArchiveStreamState)); state.tablespacenum = -1; state.compress = compress; @@ -1612,7 +1612,7 @@ ReceiveTarFile(PGconn *conn, char *archive_name, char *spclocation, bool expect_unterminated_tarfile; /* Pass all COPY data through to the backup streamer. */ - memset(&state, 0, sizeof(state)); + memset(&state, 0, sizeof(WriteTarState)); is_recovery_guc_supported = PQserverVersion(conn) >= MINIMUM_VERSION_FOR_RECOVERY_GUC; expect_unterminated_tarfile = diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c index ea3902c971..7c19e2ee24 100644 --- a/src/bin/pg_basebackup/pg_receivewal.c +++ b/src/bin/pg_basebackup/pg_receivewal.c @@ -439,7 +439,7 @@ FindStreamingStart(uint32 *tli) LZ4F_decompressOptions_t dec_opt; LZ4F_errorCode_t status; - memset(&dec_opt, 0, sizeof(dec_opt)); + memset(&dec_opt, 0, sizeof(LZ4F_decompressOptions_t)); snprintf(fullpath, sizeof(fullpath), "%s/%s", basedir, dirent->d_name); fd = open(fullpath, O_RDONLY | PG_BINARY, 0); @@ -567,7 +567,7 @@ StreamLog(void) StreamCtl stream; char *sysidentifier; - MemSet(&stream, 0, sizeof(stream)); + MemSet(&stream, 0, sizeof(StreamCtl)); /* * Connect in replication mode to the server diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c index cc292718da..6c119a6757 100644 --- a/src/bin/pg_basebackup/walmethods.c +++ b/src/bin/pg_basebackup/walmethods.c @@ -179,7 +179,7 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_ lz4buf = pg_malloc0(lz4bufsize); /* assign the compression level, default is 0 */ - memset(&prefs, 0, sizeof(prefs)); + memset(&prefs, 0, sizeof(LZ4F_preferences_t)); prefs.compressionLevel = dir_data->compression_level; /* add the header */ diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index dd78e5bc66..6e31fabb8d 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -1632,7 +1632,7 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv) status.dwServiceSpecificExitCode = 0; status.dwCurrentState = SERVICE_START_PENDING; - memset(&pi, 0, sizeof(pi)); + memset(&pi, 0, sizeof(PROCESS_INFORMATION)); read_post_opts(); diff --git a/src/bin/pg_verifybackup/pg_verifybackup.c b/src/bin/pg_verifybackup/pg_verifybackup.c index bd18b4491d..9bb61ba6a2 100644 --- a/src/bin/pg_verifybackup/pg_verifybackup.c +++ b/src/bin/pg_verifybackup/pg_verifybackup.c @@ -182,7 +182,7 @@ main(int argc, char **argv) set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_verifybackup")); progname = get_progname(argv[0]); - memset(&context, 0, sizeof(context)); + memset(&context, 0, sizeof(verifier_context)); if (argc > 1) { diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index b51d28780b..00a44e3589 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -5172,7 +5172,7 @@ do_watch(PQExpBuffer query_buf, double sleep) #ifdef HAVE_POSIX_DECL_SIGWAIT /* Disable the interval timer. */ - memset(&interval, 0, sizeof(interval)); + memset(&interval, 0, sizeof(struct itimerval)); setitimer(ITIMER_REAL, &interval, NULL); /* Unblock SIGINT, SIGCHLD and SIGALRM. */ sigprocmask(SIG_UNBLOCK, &sigalrm_sigchld_sigint, NULL); diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 92f1ffe147..b444256482 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -127,7 +127,7 @@ main(int argc, char *argv[]) int tbl_count = 0; /* initialize options */ - memset(&vacopts, 0, sizeof(vacopts)); + memset(&vacopts, 0, sizeof(vacuumingOptions)); vacopts.parallel_workers = -1; vacopts.no_index_cleanup = false; vacopts.force_index_cleanup = false; diff --git a/src/common/ip.c b/src/common/ip.c index cd73d49679..771d752a8a 100644 --- a/src/common/ip.c +++ b/src/common/ip.c @@ -171,7 +171,7 @@ getaddrinfo_unix(const char *path, const struct addrinfo *hintsp, *result = NULL; - MemSet(&hints, 0, sizeof(hints)); + MemSet(&hints, 0, sizeof(struct addrinfo)); if (strlen(path) >= sizeof(unp->sun_path)) return EAI_FAIL; @@ -182,7 +182,7 @@ getaddrinfo_unix(const char *path, const struct addrinfo *hintsp, hints.ai_socktype = SOCK_STREAM; } else - memcpy(&hints, hintsp, sizeof(hints)); + memcpy(&hints, hintsp, sizeof(struct addrinfo)); if (hints.ai_socktype == 0) hints.ai_socktype = SOCK_STREAM; diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 0a072a36dc..9c96c94d4a 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -737,12 +737,12 @@ pg_local_sendauth(PGconn *conn) iov.iov_base = &buf; iov.iov_len = 1; - memset(&msg, 0, sizeof(msg)); + memset(&msg, 0, sizeof(struct msghdr)); msg.msg_iov = &iov; msg.msg_iovlen = 1; /* We must set up a message that will be filled in by kernel */ - memset(&cmsgbuf, 0, sizeof(cmsgbuf)); + memset(&cmsgbuf, 0, sizeof(struct cmsghdr)); msg.msg_control = &cmsgbuf.buf; msg.msg_controllen = sizeof(cmsgbuf.buf); cmsg = CMSG_FIRSTHDR(&msg); diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 6e936bbff3..bb70a90d5e 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -2378,7 +2378,7 @@ keep_going: /* We will come back to here until there is ch = &conn->connhost[conn->whichhost]; /* Initialize hint structure */ - MemSet(&hint, 0, sizeof(hint)); + MemSet(&hint, 0, sizeof(struct addrinfo)); hint.ai_socktype = SOCK_STREAM; conn->addrlist_family = hint.ai_family = AF_UNSPEC; diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index edb93ec1c4..c7c7930951 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1844,7 +1844,7 @@ plperl_call_handler(PG_FUNCTION_ARGS) plperl_call_data this_call_data; /* Initialize current-call status record */ - MemSet(&this_call_data, 0, sizeof(this_call_data)); + MemSet(&this_call_data, 0, sizeof(plperl_call_data)); this_call_data.fcinfo = fcinfo; PG_TRY(); @@ -1890,7 +1890,7 @@ plperl_inline_handler(PG_FUNCTION_ARGS) ErrorContextCallback pl_error_context; /* Initialize current-call status record */ - MemSet(&this_call_data, 0, sizeof(this_call_data)); + MemSet(&this_call_data, 0, sizeof(plperl_call_data)); /* Set up a callback for error reporting */ pl_error_context.callback = plperl_inline_callback; @@ -1904,8 +1904,8 @@ plperl_inline_handler(PG_FUNCTION_ARGS) * with no arguments passed, and a result type of VOID. */ MemSet(fake_fcinfo, 0, SizeForFunctionCallInfo(0)); - MemSet(&flinfo, 0, sizeof(flinfo)); - MemSet(&desc, 0, sizeof(desc)); + MemSet(&flinfo, 0, sizeof(FmgrInfo)); + MemSet(&desc, 0, sizeof(plperl_proc_desc)); fake_fcinfo->flinfo = &flinfo; flinfo.fn_oid = InvalidOid; flinfo.fn_mcxt = CurrentMemoryContext; diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c index 190d286f1c..2b58c3202c 100644 --- a/src/pl/plpgsql/src/pl_handler.c +++ b/src/pl/plpgsql/src/pl_handler.c @@ -341,7 +341,7 @@ plpgsql_inline_handler(PG_FUNCTION_ARGS) * with no arguments passed. */ MemSet(fake_fcinfo, 0, SizeForFunctionCallInfo(0)); - MemSet(&flinfo, 0, sizeof(flinfo)); + MemSet(&flinfo, 0, sizeof(FmgrInfo)); fake_fcinfo->flinfo = &flinfo; flinfo.fn_oid = InvalidOid; flinfo.fn_mcxt = CurrentMemoryContext; @@ -518,19 +518,19 @@ plpgsql_validator(PG_FUNCTION_ARGS) * plpgsql_compile(). */ MemSet(fake_fcinfo, 0, SizeForFunctionCallInfo(0)); - MemSet(&flinfo, 0, sizeof(flinfo)); + MemSet(&flinfo, 0, sizeof(FmgrInfo)); fake_fcinfo->flinfo = &flinfo; flinfo.fn_oid = funcoid; flinfo.fn_mcxt = CurrentMemoryContext; if (is_dml_trigger) { - MemSet(&trigdata, 0, sizeof(trigdata)); + MemSet(&trigdata, 0, sizeof(TriggerData)); trigdata.type = T_TriggerData; fake_fcinfo->context = (Node *) &trigdata; } else if (is_event_trigger) { - MemSet(&etrigdata, 0, sizeof(etrigdata)); + MemSet(&etrigdata, 0, sizeof(EventTriggerData)); etrigdata.type = T_EventTriggerData; fake_fcinfo->context = (Node *) &etrigdata; } diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c index 0bce106495..0d84d66684 100644 --- a/src/pl/plpython/plpy_main.c +++ b/src/pl/plpython/plpy_main.c @@ -278,7 +278,7 @@ plpython3_inline_handler(PG_FUNCTION_ARGS) elog(ERROR, "SPI_connect failed"); MemSet(fcinfo, 0, SizeForFunctionCallInfo(0)); - MemSet(&flinfo, 0, sizeof(flinfo)); + MemSet(&flinfo, 0, sizeof(FmgrInfo)); fake_fcinfo->flinfo = &flinfo; flinfo.fn_oid = InvalidOid; flinfo.fn_mcxt = CurrentMemoryContext; diff --git a/src/port/getaddrinfo.c b/src/port/getaddrinfo.c index 3284c6eb52..818fc6151d 100644 --- a/src/port/getaddrinfo.c +++ b/src/port/getaddrinfo.c @@ -146,12 +146,12 @@ getaddrinfo(const char *node, const char *service, if (hintp == NULL) { - memset(&hints, 0, sizeof(hints)); + memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; } else - memcpy(&hints, hintp, sizeof(hints)); + memcpy(&hints, hintp, sizeof(struct addrinfo)); if (hints.ai_family != AF_INET && hints.ai_family != AF_UNSPEC) return EAI_FAMILY; @@ -162,7 +162,7 @@ getaddrinfo(const char *node, const char *service, if (!node && !service) return EAI_NONAME; - memset(&sin, 0, sizeof(sin)); + memset(&sin, 0, sizeof(struct sockaddr_in)); sin.sin_family = AF_INET; diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c index 12179f2514..c409694539 100644 --- a/src/test/isolation/isolationtester.c +++ b/src/test/isolation/isolationtester.c @@ -1121,7 +1121,7 @@ printResultSet(PGresult *res) { PQprintOpt popt; - memset(&popt, 0, sizeof(popt)); + memset(&popt, 0, sizeof(PQprintOpt)); popt.header = true; popt.align = true; popt.fieldSep = "|"; diff --git a/src/test/modules/test_shm_mq/setup.c b/src/test/modules/test_shm_mq/setup.c index 6f1f4cf9c6..6a0e40db8e 100644 --- a/src/test/modules/test_shm_mq/setup.c +++ b/src/test/modules/test_shm_mq/setup.c @@ -212,7 +212,7 @@ setup_background_workers(int nworkers, dsm_segment *seg) PointerGetDatum(wstate)); /* Configure a worker. */ - memset(&worker, 0, sizeof(worker)); + memset(&worker, 0, sizeof(BackgroundWorker)); worker.bgw_flags = BGWORKER_SHMEM_ACCESS; worker.bgw_start_time = BgWorkerStart_ConsistentState; worker.bgw_restart_time = BGW_NEVER_RESTART; diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c index 5b541ec47f..13c6afa694 100644 --- a/src/test/modules/worker_spi/worker_spi.c +++ b/src/test/modules/worker_spi/worker_spi.c @@ -325,7 +325,7 @@ _PG_init(void) MarkGUCPrefixReserved("worker_spi"); /* set up common data for all our workers */ - memset(&worker, 0, sizeof(worker)); + memset(&worker, 0, sizeof(BackgroundWorker)); worker.bgw_flags = BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION; worker.bgw_start_time = BgWorkerStart_RecoveryFinished; @@ -359,7 +359,7 @@ worker_spi_launch(PG_FUNCTION_ARGS) BgwHandleStatus status; pid_t pid; - memset(&worker, 0, sizeof(worker)); + memset(&worker, 0, sizeof(BackgroundWorker)); worker.bgw_flags = BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION; worker.bgw_start_time = BgWorkerStart_RecoveryFinished; diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index 982801e029..66e8eae77c 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -1125,7 +1125,7 @@ spawn_process(const char *cmdline) if (comspec == NULL) comspec = "CMD"; - memset(&pi, 0, sizeof(pi)); + memset(&pi, 0, sizeof(PROCESS_INFORMATION)); cmdline2 = psprintf("\"%s\" /c \"%s\"", comspec, cmdline); if ((restrictedToken = diff --git a/src/tools/msvc/MSBuildProject.pm b/src/tools/msvc/MSBuildProject.pm index f24d9e5348..5e2a300127 100644 --- a/src/tools/msvc/MSBuildProject.pm +++ b/src/tools/msvc/MSBuildProject.pm @@ -331,7 +331,7 @@ sub WriteItemDefinitionGroup .\\$cfgname\\$self->{name}\\ .\\$cfgname\\$self->{name}\\ false - Level3 + Level4 true ProgramDatabase Default