Skip to content

Commit 3848d21

Browse files
committed
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
1 parent 414cd43 commit 3848d21

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/backend/statistics/extended_stats.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ statext_store(Relation pg_stext, Oid statOid,
301301
bool nulls[Natts_pg_statistic_ext];
302302
bool replaces[Natts_pg_statistic_ext];
303303

304-
memset(nulls, 1, Natts_pg_statistic_ext * sizeof(bool));
305-
memset(replaces, 0, Natts_pg_statistic_ext * sizeof(bool));
306-
memset(values, 0, Natts_pg_statistic_ext * sizeof(Datum));
304+
memset(nulls, true, sizeof(nulls));
305+
memset(replaces, false, sizeof(replaces));
306+
memset(values, 0, sizeof(values));
307307

308308
/*
309309
* Construct a new pg_statistic_ext tuple, replacing the calculated stats.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy