8000 Silence compiler warnings · postgrespro/postgres_cluster@5099e8e · GitHub
[go: up one dir, main page]

Skip to content

Commit 5099e8e

Browse files
committed
Silence compiler warnings
Rearrange a bit of code to ensure that 'mode' in LWLockRelease is obviously always set, which seems a bit cleaner and avoids a compiler warning (thanks to Robert for the suggestion!). Back-patch back to 9.5 where the warning is first seen. Author: Stephen Frost Discussion: https://postgr.es/m/20161129152102.GR13284%40tamriel.snowman.net
1 parent 7911e78 commit 5099e8e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/backend/storage/lmgr/lwlock.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,15 +1781,14 @@ LWLockRelease(LWLock *lock)
17811781
* be the latest-acquired lock; so search array backwards.
17821782
*/
17831783
for (i = num_held_lwlocks; --i >= 0;)
1784-
{
17851784
if (lock == held_lwlocks[i].lock)
1786-
{
1787-
mode = held_lwlocks[i].mode;
17881785
break;
1789-
}
1790-
}
1786+
17911787
if (i < 0)
17921788
elog(ERROR, "lock %s %d is not held", T_NAME(lock), T_ID(lock));
1789+
1790+
mode = held_lwlocks[i].mode;
1791+
17931792
num_held_lwlocks--;
17941793
for (; i < num_held_lwlocks; i++)
17951794
held_lwlocks[i] = held_lwlocks[i + 1];

0 commit comments

Comments
 (0)
0