summaryrefslogtreecommitdiff
path: root/src/protocols/OutputPower.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/OutputPower.cpp
parent2bad73354a5dbb9be8ba9a39b6238017a216a25b (diff)
core: add LIKELY and UNLIKELY macros
helps the compiler optimize
Diffstat (limited to 'src/protocols/OutputPower.cpp')
-rw-r--r--src/protocols/OutputPower.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/protocols/OutputPower.cpp b/src/protocols/OutputPower.cpp
index dd3e8e1a..f97babc2 100644
--- a/src/protocols/OutputPower.cpp
+++ b/src/protocols/OutputPower.cpp
@@ -3,7 +3,7 @@
#include "../helpers/Monitor.hpp"
COutputPower::COutputPower(SP<CZwlrOutputPowerV1> resource_, PHLMONITOR pMonitor_) : resource(resource_), pMonitor(pMonitor_) {
- if (!resource->resource())
+ if UNLIKELY (!resource->resource())
return;
resource->setDestroy([this](CZwlrOutputPowerV1* r) { PROTO::outputPower->destroyOutputPower(this); });
@@ -62,7 +62,7 @@ void COutputPowerProtocol::onGetOutputPower(CZwlrOutputPowerManagerV1* pMgr, uin
const auto OUTPUT = CWLOutputResource::fromResource(output);
- if (!OUTPUT) {
+ if UNLIKELY (!OUTPUT) {
pMgr->error(0, "Invalid output resource");
return;
}
@@ -70,7 +70,7 @@ void COutputPowerProtocol::onGetOutputPower(CZwlrOutputPowerManagerV1* pMgr, uin
const auto CLIENT = pMgr->client();
const auto RESOURCE = m_vOutputPowers.emplace_back(std::make_unique<COutputPower>(makeShared<CZwlrOutputPowerV1>(CLIENT, pMgr->version(), id), OUTPUT->monitor.lock())).get();
- if (!RESOURCE->good()) {
+ if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
m_vOutputPowers.pop_back();
return;