diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-11 09:35:22 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-04-11 09:35:22 -0600 |
commit | 15989609ffafc5b5eef4dbde49419842a8b249fd (patch) | |
tree | e164d337e199923d1f77148a56d909af37549f14 /libcr_ipc/rwmutex.c | |
parent | 72028362733820bbd22fd6bbe84c432110329739 (diff) |
libmisc: LM_CAST_FIELD_TO_STRUCT: Allow the pointer to be NULL
Diffstat (limited to 'libcr_ipc/rwmutex.c')
-rw-r--r-- | libcr_ipc/rwmutex.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libcr_ipc/rwmutex.c b/libcr_ipc/rwmutex.c index 506459a..4c5da81 100644 --- a/libcr_ipc/rwmutex.c +++ b/libcr_ipc/rwmutex.c @@ -52,9 +52,8 @@ void cr_rwmutex_rlock(cr_rwmutex_t *mu) { lm_sll_pop_from_front(&mu->waiters); mu->nreaders++; mu->locked = true; - struct cr_rwmutex_waiter *waiter = mu->waiters.front - ? lm_sll_node_cast(struct cr_rwmutex_waiter, mu->waiters.front) - : NULL; + struct cr_rwmutex_waiter *waiter = + lm_sll_node_cast(struct cr_rwmutex_waiter, mu->waiters.front); if (waiter && waiter->is_reader) { assert(mu->unpausing); cr_unpause(waiter->cid); |