diff options
author | Peter Eisentraut | 2022-07-16 06:42:15 +0000 |
---|---|---|
committer | Peter Eisentraut | 2022-07-16 06:50:49 +0000 |
commit | 9fd45870c1436b477264c0c82eb195df52bc0919 (patch) | |
tree | 10a09724c0bcffa8f58f262e50c3260cde484446 /contrib/postgres_fdw | |
parent | c94ae9d827a360d74da6a304692d34a4dc8b6445 (diff) |
Replace many MemSet calls with struct initialization
This replaces all MemSet() calls with struct initialization where that
is easily and obviously possible. (For example, some cases have to
worry about padding bits, so I left those.)
(The same could be done with appropriate memset() calls, but this
patch is part of an effort to phase out MemSet(), so it doesn't touch
memset() calls.)
Reviewed-by: Ranier Vilela <ranier.vf@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://www.postgresql.org/message-id/9847b13c-b785-f4e2-75c3-12ec77a3b05c@enterprisedb.com
Diffstat (limited to 'contrib/postgres_fdw')
-rw-r--r-- | contrib/postgres_fdw/connection.c | 7 | ||||
-rw-r--r-- | contrib/postgres_fdw/postgres_fdw.c | 3 |
2 files changed, 3 insertions, 7 deletions
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); |