mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
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
This commit is contained in:
@@ -172,8 +172,8 @@ pg_lock_status(PG_FUNCTION_ARGS)
|
||||
LOCKMODE mode = 0;
|
||||
const char *locktypename;
|
||||
char tnbuf[32];
|
||||
Datum values[NUM_LOCK_STATUS_COLUMNS];
|
||||
bool nulls[NUM_LOCK_STATUS_COLUMNS];
|
||||
Datum values[NUM_LOCK_STATUS_COLUMNS] = {0};
|
||||
bool nulls[NUM_LOCK_STATUS_COLUMNS] = {0};
|
||||
HeapTuple tuple;
|
||||
Datum result;
|
||||
LockInstanceData *instance;
|
||||
@@ -230,8 +230,6 @@ pg_lock_status(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Form tuple with appropriate data.
|
||||
*/
|
||||
MemSet(values, 0, sizeof(values));
|
||||
MemSet(nulls, false, sizeof(nulls));
|
||||
|
||||
if (instance->locktag.locktag_type <= LOCKTAG_LAST_TYPE)
|
||||
locktypename = LockTagTypeNames[instance->locktag.locktag_type];
|
||||
@@ -359,8 +357,8 @@ pg_lock_status(PG_FUNCTION_ARGS)
|
||||
|
||||
PREDICATELOCKTARGETTAG *predTag = &(predLockData->locktags[mystatus->predLockIdx]);
|
||||
SERIALIZABLEXACT *xact = &(predLockData->xacts[mystatus->predLockIdx]);
|
||||
Datum values[NUM_LOCK_STATUS_COLUMNS];
|
||||
bool nulls[NUM_LOCK_STATUS_COLUMNS];
|
||||
Datum values[NUM_LOCK_STATUS_COLUMNS] = {0};
|
||||
bool nulls[NUM_LOCK_STATUS_COLUMNS] = {0};
|
||||
HeapTuple tuple;
|
||||
Datum result;
|
||||
|
||||
@@ -369,8 +367,6 @@ pg_lock_status(PG_FUNCTION_ARGS)
|
||||
/*
|
||||
* Form tuple with appropriate data.
|
||||
*/
|
||||
MemSet(values, 0, sizeof(values));
|
||||
MemSet(nulls, false, sizeof(nulls));
|
||||
|
||||
/* lock type */
|
||||
lockType = GET_PREDICATELOCKTARGETTAG_TYPE(*predTag);
|
||||
|
||||
Reference in New Issue
Block a user