diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-07-16 08:42:15 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-07-16 08:50:49 +0200 |
commit | 9fd45870c1436b477264c0c82eb195df52bc0919 (patch) | |
tree | 10a09724c0bcffa8f58f262e50c3260cde484446 /src/backend/utils/adt/datetime.c | |
parent | c94ae9d827a360d74da6a304692d34a4dc8b6445 (diff) | |
download | postgresql-9fd45870c1436b477264c0c82eb195df52bc0919.tar.gz postgresql-9fd45870c1436b477264c0c82eb195df52bc0919.zip |
Replace many MemSet calls with struct initialization
This replaces all MemSet() calls with struct initialization where that
is easily and obviously possible. (For example, some cases have to
worry about padding bits, so I left those.)
(The same could be done with appropriate memset() calls, but this
patch is part of an effort to phase out MemSet(), so it doesn't touch
memset() calls.)
Reviewed-by: Ranier Vilela <ranier.vf@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://www.postgresql.org/message-id/9847b13c-b785-f4e2-75c3-12ec77a3b05c@enterprisedb.com
Diffstat (limited to 'src/backend/utils/adt/datetime.c')
-rw-r--r-- | src/backend/utils/adt/datetime.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 4c12c4d6630..43fff50d490 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -4924,7 +4924,7 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS) Datum result; HeapTuple tuple; Datum values[3]; - bool nulls[3]; + bool nulls[3] = {0}; const datetkn *tp; char buffer[TOKMAXLEN + 1]; int gmtoffset; @@ -5011,8 +5011,6 @@ pg_timezone_abbrevs(PG_FUNCTION_ARGS) break; } - MemSet(nulls, 0, sizeof(nulls)); - /* * Convert name to text, using upcasing conversion that is the inverse of * what ParseDateTime() uses. @@ -5051,7 +5049,7 @@ pg_timezone_names(PG_FUNCTION_ARGS) pg_tzenum *tzenum; pg_tz *tz; Datum values[4]; - bool nulls[4]; + bool nulls[4] = {0}; int tzoff; struct pg_tm tm; fsec_t fsec; @@ -5088,8 +5086,6 @@ pg_timezone_names(PG_FUNCTION_ARGS) if (tzn && strlen(tzn) > 31) continue; - MemSet(nulls, 0, sizeof(nulls)); - values[0] = CStringGetTextDatum(pg_get_timezone_name(tz)); values[1] = CStringGetTextDatum(tzn ? tzn : ""); |