Skip to content

Commit 1a7a436

Browse files
committed
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
1 parent af4472b commit 1a7a436

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

contrib/sepgsql/uavc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ sepgsql_avc_check_perms_label(const char *tcontext,
407407
audit_name != SEPGSQL_AVC_NOAUDIT &&
408408
sepgsql_get_mode() != SEPGSQL_MODE_INTERNAL)
409409
{
410-
sepgsql_audit_log(!!denied,
410+
sepgsql_audit_log(denied != 0,
411411
cache->scontext,
412412
cache->tcontext_is_valid ?
413413
cache->tcontext : sepgsql_avc_unlabeled(),

src/backend/access/transam/xact.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5335,7 +5335,8 @@ xact_redo_commit(xl_xact_parsed_commit *parsed,
53355335
LWLockRelease(XidGenLock);
53365336
}
53375337

5338-
Assert(!!(parsed->xinfo & XACT_XINFO_HAS_ORIGIN) == (origin_id != InvalidRepOriginId));
5338+
Assert(((parsed->xinfo & XACT_XINFO_HAS_ORIGIN) == 0) ==
5339+
(origin_id == InvalidRepOriginId));
53395340

53405341
if (parsed->xinfo & XACT_XINFO_HAS_ORIGIN)
53415342
commit_time = parsed->origin_timestamp;

src/backend/replication/logical/reorderbuffer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ ReorderBufferTXNByXid(ReorderBuffer *rb, TransactionId xid, bool create,
603603
if (is_new)
604604
*is_new = !found;
605605

606-
Assert(!create || !!txn);
606+
Assert(!create || txn != NULL);
607607
return txn;
608608
}
609609

src/backend/storage/lmgr/lwlock.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,23 @@ PRINT_LWDEBUG(const char *where, LWLock *lock, LWLockMode mode)
209209
errmsg_internal("%d: %s(%s): excl %u shared %u haswaiters %u waiters %u rOK %d",
210210
MyProcPid,
211211
where, MainLWLockNames[id],
212-
!!(state & LW_VAL_EXCLUSIVE),
212+
(state & LW_VAL_EXCLUSIVE) != 0,
213213
state & LW_SHARED_MASK,
214-
!!(state & LW_FLAG_HAS_WAITERS),
214+
(state & LW_FLAG_HAS_WAITERS) != 0,
215215
pg_atomic_read_u32(&lock->nwaiters),
216-
!!(state & LW_FLAG_RELEASE_OK))));
216+
(state & LW_FLAG_RELEASE_OK) != 0)));
217217
else
218218
ereport(LOG,
219219
(errhidestmt(true),
220220
errhidecontext(true),
221221
errmsg_internal("%d: %s(%s %d): excl %u shared %u haswaiters %u waiters %u rOK %d",
222222
MyProcPid,
223223
where, T_NAME(lock), id,
224-
!!(state & LW_VAL_EXCLUSIVE),
224+
(state & LW_VAL_EXCLUSIVE) != 0,
225225
state & LW_SHARED_MASK,
226-
!!(state & LW_FLAG_HAS_WAITERS),
226+
(state & LW_FLAG_HAS_WAITERS) != 0,
227227
pg_atomic_read_u32(&lock->nwaiters),
228-
!!(state & LW_FLAG_RELEASE_OK))));
228+
(state & LW_FLAG_RELEASE_OK) != 0)));
229229
}
230230
}
231231

src/include/access/xact.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
149149

150150
/* Access macros for above flags */
151151
#define XactCompletionRelcacheInitFileInval(xinfo) \
152-
(!!(xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE))
152+
((xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) != 0)
153153
#define XactCompletionForceSyncCommit(xinfo) \
154-
(!!(xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT))
154+
((xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) != 0)
155155

156156
typedef struct xl_xact_assignment
157157
{

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