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/access/transam/xlogfuncs.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/backend/access/transam/xlogfuncs.c') diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index 02bd919ff64..61e0f4a29ca 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -106,8 +106,8 @@ pg_backup_stop(PG_FUNCTION_ARGS) { #define PG_STOP_BACKUP_V2_COLS 3 TupleDesc tupdesc; - Datum values[PG_STOP_BACKUP_V2_COLS]; - bool nulls[PG_STOP_BACKUP_V2_COLS]; + Datum values[PG_STOP_BACKUP_V2_COLS] = {0}; + bool nulls[PG_STOP_BACKUP_V2_COLS] = {0}; bool waitforarchive = PG_GETARG_BOOL(0); XLogRecPtr stoppoint; @@ -117,9 +117,6 @@ pg_backup_stop(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)); - if (status != SESSION_BACKUP_RUNNING) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), -- cgit v1.2.3