git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 414cd43)
Make memset() use sizeof() rather than re-compute size
2017年11月29日 03:09:17 +0000 (00:09 -0300)
2017年11月29日 03:13:45 +0000 (00:13 -0300)
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 eeed56ff0aa4b780bc514cc2a19e89e1d31e3186..26c2aedd36caef2119506e2e7bf2345374a69781 100644 (file)
--- 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.
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /