]> granicus.if.org Git - postgresql/commitdiff
Use LOCKBIT_ON() instead of a bit shift in a few places.
authorRobert Haas <rhaas@postgresql.org>
Mon, 28 Sep 2015 14:57:15 +0000 (10:57 -0400)
committerRobert Haas <rhaas@postgresql.org>
Mon, 28 Sep 2015 14:57:15 +0000 (10:57 -0400)
We do this mostly everywhere, so it seems just as well to do it here,
too.

Thomas Munro

src/backend/storage/lmgr/deadlock.c
src/backend/storage/lmgr/lock.c

index aea46b28ffc1512aa73743dd3187965a22844d11..fd5ab21a081d962b134fc4e35ccba97597f6bc3c 100644 (file)
@@ -608,7 +608,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
                                break;
 
                        /* Is there a conflict with this guy's request? */
-                       if (((1 << proc->waitLockMode) & conflictMask) != 0)
+                       if ((LOCKBIT_ON(proc->waitLockMode) & conflictMask) != 0)
                        {
                                /* This proc soft-blocks checkProc */
                                if (FindLockCycleRecurse(proc, depth + 1,
@@ -648,7 +648,7 @@ FindLockCycleRecurse(PGPROC *checkProc,
                                break;
 
                        /* Is there a conflict with this guy's request? */
-                       if (((1 << proc->waitLockMode) & conflictMask) != 0)
+                       if ((LOCKBIT_ON(proc->waitLockMode) & conflictMask) != 0)
                        {
                                /* This proc soft-blocks checkProc */
                                if (FindLockCycleRecurse(proc, depth + 1,
index c377d384b765a7efa1d9483d53fe7f5855e1f42a..76fc615cd594ca098b4470bb78d9729bb554d642 100644 (file)
@@ -64,41 +64,41 @@ static const LOCKMASK LockConflicts[] = {
        0,
 
        /* AccessShareLock */
-       (1 << AccessExclusiveLock),
+       LOCKBIT_ON(AccessExclusiveLock),
 
        /* RowShareLock */
-       (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
+       LOCKBIT_ON(ExclusiveLock) | LOCKBIT_ON(AccessExclusiveLock),
 
        /* RowExclusiveLock */
-       (1 << ShareLock) | (1 << ShareRowExclusiveLock) |
-       (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
+       LOCKBIT_ON(ShareLock) | LOCKBIT_ON(ShareRowExclusiveLock) |
+       LOCKBIT_ON(ExclusiveLock) | LOCKBIT_ON(AccessExclusiveLock),
 
        /* ShareUpdateExclusiveLock */
-       (1 << ShareUpdateExclusiveLock) |
-       (1 << ShareLock) | (1 << ShareRowExclusiveLock) |
-       (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
+       LOCKBIT_ON(ShareUpdateExclusiveLock) |
+       LOCKBIT_ON(ShareLock) | LOCKBIT_ON(ShareRowExclusiveLock) |
+       LOCKBIT_ON(ExclusiveLock) | LOCKBIT_ON(AccessExclusiveLock),
 
        /* ShareLock */
-       (1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
-       (1 << ShareRowExclusiveLock) |
-       (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
+       LOCKBIT_ON(RowExclusiveLock) | LOCKBIT_ON(ShareUpdateExclusiveLock) |
+       LOCKBIT_ON(ShareRowExclusiveLock) |
+       LOCKBIT_ON(ExclusiveLock) | LOCKBIT_ON(AccessExclusiveLock),
 
        /* ShareRowExclusiveLock */
-       (1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
-       (1 << ShareLock) | (1 << ShareRowExclusiveLock) |
-       (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
+       LOCKBIT_ON(RowExclusiveLock) | LOCKBIT_ON(ShareUpdateExclusiveLock) |
+       LOCKBIT_ON(ShareLock) | LOCKBIT_ON(ShareRowExclusiveLock) |
+       LOCKBIT_ON(ExclusiveLock) | LOCKBIT_ON(AccessExclusiveLock),
 
        /* ExclusiveLock */
-       (1 << RowShareLock) |
-       (1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
-       (1 << ShareLock) | (1 << ShareRowExclusiveLock) |
-       (1 << ExclusiveLock) | (1 << AccessExclusiveLock),
+       LOCKBIT_ON(RowShareLock) |
+       LOCKBIT_ON(RowExclusiveLock) | LOCKBIT_ON(ShareUpdateExclusiveLock) |
+       LOCKBIT_ON(ShareLock) | LOCKBIT_ON(ShareRowExclusiveLock) |
+       LOCKBIT_ON(ExclusiveLock) | LOCKBIT_ON(AccessExclusiveLock),
 
        /* AccessExclusiveLock */
-       (1 << AccessShareLock) | (1 << RowShareLock) |
-       (1 << RowExclusiveLock) | (1 << ShareUpdateExclusiveLock) |
-       (1 << ShareLock) | (1 << ShareRowExclusiveLock) |
-       (1 << ExclusiveLock) | (1 << AccessExclusiveLock)
+       LOCKBIT_ON(AccessShareLock) | LOCKBIT_ON(RowShareLock) |
+       LOCKBIT_ON(RowExclusiveLock) | LOCKBIT_ON(ShareUpdateExclusiveLock) |
+       LOCKBIT_ON(ShareLock) | LOCKBIT_ON(ShareRowExclusiveLock) |
+       LOCKBIT_ON(ExclusiveLock) | LOCKBIT_ON(AccessExclusiveLock)
 
 };