diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-07-16 08:42:15 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-07-16 08:50:49 +0200 |
commit | 9fd45870c1436b477264c0c82eb195df52bc0919 (patch) | |
tree | 10a09724c0bcffa8f58f262e50c3260cde484446 /src/bin/pg_basebackup/walmethods.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 <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/bin/pg_basebackup/walmethods.c')
-rw-r--r-- | src/bin/pg_basebackup/walmethods.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c index ef4c11277ac..e90aa0ba377 100644 --- a/src/bin/pg_basebackup/walmethods.c +++ b/src/bin/pg_basebackup/walmethods.c @@ -1111,9 +1111,8 @@ tar_close(Walfile f, WalCloseMethod method) padding = tarPaddingBytesRequired(filesize); if (padding) { - char zerobuf[TAR_BLOCK_SIZE]; + char zerobuf[TAR_BLOCK_SIZE] = {0}; - MemSet(zerobuf, 0, padding); if (tar_write(f, zerobuf, padding) != padding) return -1; } @@ -1222,7 +1221,7 @@ tar_existsfile(const char *pathname) static bool tar_finish(void) { - char zerobuf[1024]; + char zerobuf[1024] = {0}; tar_clear_error(); @@ -1233,7 +1232,6 @@ tar_finish(void) } /* A tarfile always ends with two empty blocks */ - MemSet(zerobuf, 0, sizeof(zerobuf)); if (tar_data->compression_algorithm == PG_COMPRESSION_NONE) { errno = 0; |