From: Alvaro Herrera Date: Wed, 29 Nov 2017 03:09:17 +0000 (-0300) Subject: Make memset() use sizeof() rather than re-compute size X-Git-Tag: REL_11_BETA1~1146 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3848d21673e9dcb42d4bc1353043d7c7d6f550cd;p=postgresql 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 --- diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c index eeed56ff0a..26c2aedd36 100644 --- a/src/backend/statistics/extended_stats.c +++ b/src/backend/statistics/extended_stats.c @@ -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.