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/commands/typecmds.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/commands/typecmds.c')
-rw-r--r-- | src/backend/commands/typecmds.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index a8757a90bf8..d0d87a1184a 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -2570,9 +2570,9 @@ AlterDomainDefault(List *names, Node *defaultRaw) Relation rel; char *defaultValue; Node *defaultExpr = NULL; /* NULL if no default specified */ - Datum new_record[Natts_pg_type]; - bool new_record_nulls[Natts_pg_type]; - bool new_record_repl[Natts_pg_type]; + Datum new_record[Natts_pg_type] = {0}; + bool new_record_nulls[Natts_pg_type] = {0}; + bool new_record_repl[Natts_pg_type] = {0}; HeapTuple newtuple; Form_pg_type typTup; ObjectAddress address; @@ -2593,9 +2593,6 @@ AlterDomainDefault(List *names, Node *defaultRaw) checkDomainOwner(tup); /* Setup new tuple */ - MemSet(new_record, (Datum) 0, sizeof(new_record)); - MemSet(new_record_nulls, false, sizeof(new_record_nulls)); - MemSet(new_record_repl, false, sizeof(new_record_repl)); /* Store the new default into the tuple */ if (defaultRaw) |