summaryrefslogtreecommitdiff
path: root/src/protocols/PointerGestures.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/PointerGestures.cpp
parent2bad73354a5dbb9be8ba9a39b6238017a216a25b (diff)
core: add LIKELY and UNLIKELY macros
helps the compiler optimize
Diffstat (limited to 'src/protocols/PointerGestures.cpp')
-rw-r--r--src/protocols/PointerGestures.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/protocols/PointerGestures.cpp b/src/protocols/PointerGestures.cpp
index 5dfb9d51..4df51b47 100644
--- a/src/protocols/PointerGestures.cpp
+++ b/src/protocols/PointerGestures.cpp
@@ -4,7 +4,7 @@
#include "core/Compositor.hpp"
CPointerGestureSwipe::CPointerGestureSwipe(SP<CZwpPointerGestureSwipeV1> resource_) : resource(resource_) {
- if (!resource->resource())
+ if UNLIKELY (!resource->resource())
return;
resource->setOnDestroy([this](CZwpPointerGestureSwipeV1* p) { PROTO::pointerGestures->onGestureDestroy(this); });
@@ -16,7 +16,7 @@ bool CPointerGestureSwipe::good() {
}
CPointerGestureHold::CPointerGestureHold(SP<CZwpPointerGestureHoldV1> resource_) : resource(resource_) {
- if (!resource->resource())
+ if UNLIKELY (!resource->resource())
return;
resource->setOnDestroy([this](CZwpPointerGestureHoldV1* p) { PROTO::pointerGestures->onGestureDestroy(this); });
@@ -28,7 +28,7 @@ bool CPointerGestureHold::good() {
}
CPointerGesturePinch::CPointerGesturePinch(SP<CZwpPointerGesturePinchV1> resource_) : resource(resource_) {
- if (!resource->resource())
+ if UNLIKELY (!resource->resource())
return;
resource->setOnDestroy([this](CZwpPointerGesturePinchV1* p) { PROTO::pointerGestures->onGestureDestroy(this); });
@@ -73,7 +73,7 @@ void CPointerGesturesProtocol::onGetPinchGesture(CZwpPointerGesturesV1* pMgr, ui
const auto CLIENT = pMgr->client();
const auto RESOURCE = m_vPinches.emplace_back(std::make_unique<CPointerGesturePinch>(makeShared<CZwpPointerGesturePinchV1>(CLIENT, pMgr->version(), id))).get();
- if (!RESOURCE->good()) {
+ if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
LOGM(ERR, "Couldn't create gesture");
return;
@@ -84,7 +84,7 @@ void CPointerGesturesProtocol::onGetSwipeGesture(CZwpPointerGesturesV1* pMgr, ui
const auto CLIENT = pMgr->client();
const auto RESOURCE = m_vSwipes.emplace_back(std::make_unique<CPointerGestureSwipe>(makeShared<CZwpPointerGestureSwipeV1>(CLIENT, pMgr->version(), id))).get();
- if (!RESOURCE->good()) {
+ if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
LOGM(ERR, "Couldn't create gesture");
return;
@@ -95,7 +95,7 @@ void CPointerGesturesProtocol::onGetHoldGesture(CZwpPointerGesturesV1* pMgr, uin
const auto CLIENT = pMgr->client();
const auto RESOURCE = m_vHolds.emplace_back(std::make_unique<CPointerGestureHold>(makeShared<CZwpPointerGestureHoldV1>(CLIENT, pMgr->version(), id))).get();
- if (!RESOURCE->good()) {
+ if UNLIKELY (!RESOURCE->good()) {
pMgr->noMemory();
LOGM(ERR, "Couldn't create gesture");
return;