Skip to content

Commit a414d96

Browse files
committed
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.
1 parent c94f0c2 commit a414d96

File tree

1 file changed

+3
-13
lines changed
  • src/backend/storage/lmgr

1 file changed

+3
-13
lines changed

src/backend/storage/lmgr/lmgr.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,17 +1003,7 @@ DescribeLockTag(StringInfo buf, const LOCKTAG *tag)
10031003
const char *
10041004
GetLockNameFromTagType(uint16 locktag_type)
10051005
{
1006-
const char *locktypename;
1007-
char tnbuf[32];
1008-
1009-
if (locktag_type <= LOCKTAG_LAST_TYPE)
1010-
locktypename = LockTagTypeNames[locktag_type];
1011-
else
1012-
{
1013-
snprintf(tnbuf, sizeof(tnbuf), "unknown %d",
1014-
(int) locktag_type);
1015-
locktypename = tnbuf;
1016-
}
1017-
1018-
return locktypename;
1006+
if (locktag_type > LOCKTAG_LAST_TYPE)
1007+
return "???";
1008+
return LockTagTypeNames[locktag_type];
10191009
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy