1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-29 23:43:17 +03:00

Don't use !! but != 0/NULL to force boolean evaluation.

I introduced several uses of !! to force bit arithmetic to be boolean,
but per discussion the project prefers != 0/NULL.

Discussion: CA+TgmoZP5KakLGP6B4vUjgMBUW0woq_dJYi0paOz-My0Hwt_vQ@mail.gmail.com
This commit is contained in:
Andres Freund
2016-03-27 17:17:00 +02:00
parent af4472bcb8
commit 1a7a43672b
5 changed files with 12 additions and 11 deletions

View File

@@ -209,11 +209,11 @@ PRINT_LWDEBUG(const char *where, LWLock *lock, LWLockMode mode)
errmsg_internal("%d: %s(%s): excl %u shared %u haswaiters %u waiters %u rOK %d",
MyProcPid,
where, MainLWLockNames[id],
!!(state & LW_VAL_EXCLUSIVE),
(state & LW_VAL_EXCLUSIVE) != 0,
state & LW_SHARED_MASK,
!!(state & LW_FLAG_HAS_WAITERS),
(state & LW_FLAG_HAS_WAITERS) != 0,
pg_atomic_read_u32(&lock->nwaiters),
!!(state & LW_FLAG_RELEASE_OK))));
(state & LW_FLAG_RELEASE_OK) != 0)));
else
ereport(LOG,
(errhidestmt(true),
@@ -221,11 +221,11 @@ PRINT_LWDEBUG(const char *where, LWLock *lock, LWLockMode mode)
errmsg_internal("%d: %s(%s %d): excl %u shared %u haswaiters %u waiters %u rOK %d",
MyProcPid,
where, T_NAME(lock), id,
!!(state & LW_VAL_EXCLUSIVE),
(state & LW_VAL_EXCLUSIVE) != 0,
state & LW_SHARED_MASK,
!!(state & LW_FLAG_HAS_WAITERS),
(state & LW_FLAG_HAS_WAITERS) != 0,
pg_atomic_read_u32(&lock->nwaiters),
!!(state & LW_FLAG_RELEASE_OK))));
(state & LW_FLAG_RELEASE_OK) != 0)));
}
}