提交 a414d96a 编写于 作者: R Robert Haas

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.
上级 c94f0c29
......@@ -1003,17 +1003,7 @@ DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
const char *
GetLockNameFromTagType(uint16 locktag_type)
{
const char *locktypename;
char tnbuf[32];
if (locktag_type <= LOCKTAG_LAST_TYPE)
locktypename = LockTagTypeNames[locktag_type];
else
{
snprintf(tnbuf, sizeof(tnbuf), "unknown %d",
(int) locktag_type);
locktypename = tnbuf;
}
return locktypename;
if (locktag_type > LOCKTAG_LAST_TYPE)
return "???";
return LockTagTypeNames[locktag_type];
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册