1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-16 17:07:43 +03:00

Switch some palloc/memset calls to palloc0

Some code paths have been doing some allocations followed by an
immediate memset() to initialize the allocated area with zeros, this is
a bit overkill as there are already interfaces to do both things in one
call.

Author: Daniel Gustafsson
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/vN0OodBPkKs7g2Z1uyk3CUEmhdtspHgYCImhlmSxv1Xn6nY1ZnaaGHL8EWUIQ-NEv36tyc4G5-uA3UXUF2l4sFXtK_EQgLN1hcgunlFVKhA=@yesql.se
This commit is contained in:
Michael Paquier
2019-03-27 12:02:50 +09:00
parent 5bde1651bb
commit 1983af8e89
5 changed files with 6 additions and 13 deletions

View File

@@ -1382,8 +1382,7 @@ SortTocFromFile(Archive *AHX)
bool incomplete_line;
/* Allocate space for the 'wanted' array, and init it */
ropt->idWanted = (bool *) pg_malloc(sizeof(bool) * AH->maxDumpId);
memset(ropt->idWanted, 0, sizeof(bool) * AH->maxDumpId);
ropt->idWanted = (bool *) pg_malloc0(sizeof(bool) * AH->maxDumpId);
/* Setup the file */
fh = fopen(ropt->tocFile, PG_BINARY_R);