summaryrefslogtreecommitdiff
path: root/src/backend/replication/walsender.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-07-16 08:42:15 +0200
committerPeter Eisentraut <peter@eisentraut.org>2022-07-16 08:50:49 +0200
commit9fd45870c1436b477264c0c82eb195df52bc0919 (patch)
tree10a09724c0bcffa8f58f262e50c3260cde484446 /src/backend/replication/walsender.c
parentc94ae9d827a360d74da6a304692d34a4dc8b6445 (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 'src/backend/replication/walsender.c')
-rw-r--r--src/backend/replication/walsender.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 3c407ab9647..3a86786cc3a 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -402,7 +402,7 @@ IdentifySystem(void)
TupOutputState *tstate;
TupleDesc tupdesc;
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
TimeLineID currTLI;
/*
@@ -437,7 +437,6 @@ IdentifySystem(void)
}
dest = CreateDestReceiver(DestRemoteSimple);
- MemSet(nulls, false, sizeof(nulls));
/* need a tuple descriptor representing four columns */
tupdesc = CreateTemplateTupleDesc(4);
@@ -483,7 +482,7 @@ ReadReplicationSlot(ReadReplicationSlotCmd *cmd)
DestReceiver *dest;
TupOutputState *tstate;
TupleDesc tupdesc;
- Datum values[READ_REPLICATION_SLOT_COLS];
+ Datum values[READ_REPLICATION_SLOT_COLS] = {0};
bool nulls[READ_REPLICATION_SLOT_COLS];
tupdesc = CreateTemplateTupleDesc(READ_REPLICATION_SLOT_COLS);
@@ -495,8 +494,7 @@ ReadReplicationSlot(ReadReplicationSlotCmd *cmd)
TupleDescInitBuiltinEntry(tupdesc, (AttrNumber) 3, "restart_tli",
INT8OID, -1, 0);
- MemSet(values, 0, READ_REPLICATION_SLOT_COLS * sizeof(Datum));
- MemSet(nulls, true, READ_REPLICATION_SLOT_COLS * sizeof(bool));
+ memset(nulls, true, READ_REPLICATION_SLOT_COLS * sizeof(bool));
LWLockAcquire(ReplicationSlotControlLock, LW_SHARED);
slot = SearchNamedReplicationSlot(cmd->slotname, false);
@@ -859,13 +857,12 @@ StartReplication(StartReplicationCmd *cmd)
TupOutputState *tstate;
TupleDesc tupdesc;
Datum values[2];
- bool nulls[2];
+ bool nulls[2] = {0};
snprintf(startpos_str, sizeof(startpos_str), "%X/%X",
LSN_FORMAT_ARGS(sendTimeLineValidUpto));
dest = CreateDestReceiver(DestRemoteSimple);
- MemSet(nulls, false, sizeof(nulls));
/*
* Need a tuple descriptor representing two columns. int8 may seem
@@ -1043,7 +1040,7 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
TupOutputState *tstate;
TupleDesc tupdesc;
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
Assert(!MyReplicationSlot);
@@ -1178,7 +1175,6 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
LSN_FORMAT_ARGS(MyReplicationSlot->data.confirmed_flush));
dest = CreateDestReceiver(DestRemoteSimple);
- MemSet(nulls, false, sizeof(nulls));
/*----------
* Need a tuple descriptor representing four columns:
@@ -3488,7 +3484,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
TimestampTz replyTime;
bool is_sync_standby;
Datum values[PG_STAT_GET_WAL_SENDERS_COLS];
- bool nulls[PG_STAT_GET_WAL_SENDERS_COLS];
+ bool nulls[PG_STAT_GET_WAL_SENDERS_COLS] = {0};
int j;
/* Collect data from shared memory */
@@ -3527,7 +3523,6 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
}
}
- memset(nulls, 0, sizeof(nulls));
values[0] = Int32GetDatum(pid);
if (!has_privs_of_role(GetUserId(), ROLE_PG_READ_ALL_STATS))