From 9fd45870c1436b477264c0c82eb195df52bc0919 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 16 Jul 2022 08:42:15 +0200 Subject: 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 Reviewed-by: Alvaro Herrera Discussion: https://www.postgresql.org/message-id/9847b13c-b785-f4e2-75c3-12ec77a3b05c@enterprisedb.com --- src/backend/utils/adt/partitionfuncs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/backend/utils/adt/partitionfuncs.c') diff --git a/src/backend/utils/adt/partitionfuncs.c b/src/backend/utils/adt/partitionfuncs.c index 0243bc061f6..109dc8023e1 100644 --- a/src/backend/utils/adt/partitionfuncs.c +++ b/src/backend/utils/adt/partitionfuncs.c @@ -113,8 +113,8 @@ pg_partition_tree(PG_FUNCTION_ARGS) if (funcctx->call_cntr < list_length(partitions)) { Datum result; - Datum values[PG_PARTITION_TREE_COLS]; - bool nulls[PG_PARTITION_TREE_COLS]; + Datum values[PG_PARTITION_TREE_COLS] = {0}; + bool nulls[PG_PARTITION_TREE_COLS] = {0}; HeapTuple tuple; Oid parentid = InvalidOid; Oid relid = list_nth_oid(partitions, funcctx->call_cntr); @@ -126,8 +126,6 @@ pg_partition_tree(PG_FUNCTION_ARGS) /* * Form tuple with appropriate data. */ - MemSet(nulls, 0, sizeof(nulls)); - MemSet(values, 0, sizeof(values)); /* relid */ values[0] = ObjectIdGetDatum(relid); -- cgit v1.2.3