mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +03:00
Add repalloc0 and repalloc0_array
These zero out the space added by repalloc. This is a common pattern that is quite hairy to code by hand. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/b66dfc89-9365-cb57-4e1f-b7d31813eeec@enterprisedb.com
This commit is contained in:
@ -940,12 +940,8 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable)
|
||||
else
|
||||
{
|
||||
/* enlarge arrays and zero out added entries */
|
||||
hashtable->innerBatchFile = repalloc_array(hashtable->innerBatchFile, BufFile *, nbatch);
|
||||
hashtable->outerBatchFile = repalloc_array(hashtable->outerBatchFile, BufFile *, nbatch);
|
||||
MemSet(hashtable->innerBatchFile + oldnbatch, 0,
|
||||
(nbatch - oldnbatch) * sizeof(BufFile *));
|
||||
MemSet(hashtable->outerBatchFile + oldnbatch, 0,
|
||||
(nbatch - oldnbatch) * sizeof(BufFile *));
|
||||
hashtable->innerBatchFile = repalloc0_array(hashtable->innerBatchFile, BufFile *, oldnbatch, nbatch);
|
||||
hashtable->outerBatchFile = repalloc0_array(hashtable->outerBatchFile, BufFile *, oldnbatch, nbatch);
|
||||
}
|
||||
|
||||
MemoryContextSwitchTo(oldcxt);
|
||||
|
Reference in New Issue
Block a user