Make memset() use sizeof() rather than re-compute size

This is simpler and more closely follows overwhelming precedent.

Report and patch by Mark Dilger.
Discussion: https://postgr.es/m/9A68FB88-5F45-4848-9926-8586E2D777D1@gmail.com
This commit is contained in:
Alvaro Herrera 2017-11-29 00:09:17 -03:00
parent 414cd434ff
commit 3848d21673
1 changed files with 3 additions and 3 deletions

View File

@ -301,9 +301,9 @@ statext_store(Relation pg_stext, Oid statOid,
bool nulls[Natts_pg_statistic_ext];
bool replaces[Natts_pg_statistic_ext];
memset(nulls, 1, Natts_pg_statistic_ext * sizeof(bool));
memset(replaces, 0, Natts_pg_statistic_ext * sizeof(bool));
memset(values, 0, Natts_pg_statistic_ext * sizeof(Datum));
memset(nulls, true, sizeof(nulls));
memset(replaces, false, sizeof(replaces));
memset(values, 0, sizeof(values));
/*
* Construct a new pg_statistic_ext tuple, replacing the calculated stats.