diff options
author | Robert Haas | 2016-03-11 02:37:22 +0000 |
---|---|---|
committer | Robert Haas | 2016-03-11 02:37:22 +0000 |
commit | a414d96ad2b001cddf10e3dedb0bde96d0af6a0b (patch) | |
tree | f62de63f072ee37af9cf088ff781a332f1360332 | |
parent | c94f0c29cecc7944a14aa645c8a97a7250bf146b (diff) |
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.
-rw-r--r-- | src/backend/storage/lmgr/lmgr.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c index 9d2663e2f9..0632fc009e 100644 --- a/src/backend/storage/lmgr/lmgr.c +++ b/src/backend/storage/lmgr/lmgr.c @@ -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]; } |