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/pg_prewarm/autoprewarm.c | |
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 <[email protected]>
Reviewed-by: Alvaro Herrera <[email protected]>
Discussion: https://www.postgresql.org/message-id/[email protected]
Diffstat (limited to 'contrib/pg_prewarm/autoprewarm.c')
-rw-r--r-- | contrib/pg_prewarm/autoprewarm.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c index 13eee4a1379..ee20e9b0850 100644 --- a/contrib/pg_prewarm/autoprewarm.c +++ b/contrib/pg_prewarm/autoprewarm.c @@ -814,12 +814,11 @@ apw_detach_shmem(int code, Datum arg) static void apw_start_leader_worker(void) { - BackgroundWorker worker; + BackgroundWorker worker = {0}; BackgroundWorkerHandle *handle; BgwHandleStatus status; pid_t pid; - MemSet(&worker, 0, sizeof(BackgroundWorker)); worker.bgw_flags = BGWORKER_SHMEM_ACCESS; worker.bgw_start_time = BgWorkerStart_ConsistentState; strcpy(worker.bgw_library_name, "pg_prewarm"); @@ -856,10 +855,9 @@ apw_start_leader_worker(void) static void apw_start_database_worker(void) { - BackgroundWorker worker; + BackgroundWorker worker = {0}; BackgroundWorkerHandle *handle; - MemSet(&worker, 0, sizeof(BackgroundWorker)); worker.bgw_flags = BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION; worker.bgw_start_time = BgWorkerStart_ConsistentState; |