* [PATCH 2/8] util: Use unlikely() for L_WARN_ON() condition
@ 2022-04-15 18:32 Andrew Zaborowski
0 siblings, 0 replies; only message in thread
From: Andrew Zaborowski @ 2022-04-15 18:32 UTC (permalink / raw)
To: ell
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
Any condition used in L_WARN_ON() should be only true in an error or
trouble situation and thus be unlikely true. Add unlikely() directly
in the macro to avoid repeating use of L_WARN_ON(unlikely(condition))
---
ell/util.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ell/util.h b/ell/util.h
index 9d4e36c..db47ae7 100644
--- a/ell/util.h
+++ b/ell/util.h
@@ -49,7 +49,7 @@ _Pragma("GCC diagnostic pop") \
#define L_WARN_ON(condition) __extension__ ({ \
bool r = !!(condition); \
- if (r) \
+ if (unlikely(r)) \
l_warn("WARNING: %s:%s() condition %s failed", \
__FILE__, __func__, \
#condition); \
--
2.32.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-15 18:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-15 18:32 [PATCH 2/8] util: Use unlikely() for L_WARN_ON() condition Andrew Zaborowski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.