mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Simplify GetLockNameFromTagType.
The old code is wrong, because it returns a pointer to an automatic variable. And it's also more clever than we really need to be considering that the case it's worrying about should never happen.
This commit is contained in:
@ -1003,17 +1003,7 @@ DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
|
|||||||
const char *
|
const char *
|
||||||
GetLockNameFromTagType(uint16 locktag_type)
|
GetLockNameFromTagType(uint16 locktag_type)
|
||||||
{
|
{
|
||||||
const char *locktypename;
|
if (locktag_type > LOCKTAG_LAST_TYPE)
|
||||||
char tnbuf[32];
|
return "???";
|
||||||
|
return LockTagTypeNames[locktag_type];
|
||||||
if (locktag_type <= LOCKTAG_LAST_TYPE)
|
|
||||||
locktypename = LockTagTypeNames[locktag_type];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(tnbuf, sizeof(tnbuf), "unknown %d",
|
|
||||||
(int) locktag_type);
|
|
||||||
locktypename = tnbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
return locktypename;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user