summaryrefslogtreecommitdiff
path: root/src/protocols/IdleNotify.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2025-01-17 18:21:34 +0100
committervaxerski <vaxry@vaxry.net>2025-01-17 18:56:39 +0100
commitb7a3c4526990d6601ff2cac748ff860cda6bc16d (patch)
tree425c6afa0bc35f7f370a666bd7a81214a6e9475a /src/protocols/IdleNotify.cpp
parent2bad73354a5dbb9be8ba9a39b6238017a216a25b (diff)
core: add LIKELY and UNLIKELY macros
helps the compiler optimize
Diffstat (limited to 'src/protocols/IdleNotify.cpp')
-rw-r--r--src/protocols/IdleNotify.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/protocols/IdleNotify.cpp b/src/protocols/IdleNotify.cpp
index 3517a62d..85a9f8e2 100644
--- a/src/protocols/IdleNotify.cpp
+++ b/src/protocols/IdleNotify.cpp
@@ -11,7 +11,7 @@ static int onTimer(SP<CEventLoopTimer> self, void* data) {
}
CExtIdleNotification::CExtIdleNotification(SP<CExtIdleNotificationV1> resource_, uint32_t timeoutMs_) : resource(resource_), timeoutMs(timeoutMs_) {
- if (!resource_->resource())
+ if UNLIKELY (!resource_->resource())
return;
resource->setDestroy([this](CExtIdleNotificationV1* r) { PROTO::idle->destroyNotification(this); });
@@ -78,7 +78,7 @@ void CIdleNotifyProtocol::onGetNotification(CExtIdleNotifierV1* pMgr, uint32_t i
const auto CLIENT = pMgr->client();
const auto RESOURCE = m_vNotifications.emplace_back(makeShared<CExtIdleNotification>(makeShared<CExtIdleNotificationV1>(CLIENT, pMgr->version(), id), timeout)).get();
- if (!RESOURCE->good()) {
+ if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
m_vNotifications.pop_back();
return;