summaryrefslogtreecommitdiff
path: root/src/protocols
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2024-06-17 17:37:36 +0200
committerGitHub <noreply@github.com>2024-06-17 17:37:36 +0200
commit28ce0e0f804de50f75eab797bc404c1be0b54442 (patch)
tree5f8dc0161f41c52837bbbb9992bc86ec19b3a95b /src/protocols
parenta9c7a0830fd9a8b9fc4065f1cd654efd1326691a (diff)
misc: a few compiler level performance optimisations (#6559)
* window: use const references instead of copies use const references instead of wasteful copies and make the = operator check for self assignment and return early. also use const in all the other operators. * listener: pass std::function as const reference instead of copies pass the std::functions as const references. * config: dont unnecessarily convert to c_str getHyprlangConfigValuePtr wants an std::string and we already have an std::string, dont convert it to a c_str only for it to be converted back to an std::string. * buffer: pass attributes as const reference pass attributes as const reference instead of copies.
Diffstat (limited to 'src/protocols')
-rw-r--r--src/protocols/types/DMABuffer.cpp2
-rw-r--r--src/protocols/types/DMABuffer.hpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/protocols/types/DMABuffer.cpp b/src/protocols/types/DMABuffer.cpp
index f26328e9..7c3a9886 100644
--- a/src/protocols/types/DMABuffer.cpp
+++ b/src/protocols/types/DMABuffer.cpp
@@ -3,7 +3,7 @@
#include "../../render/Renderer.hpp"
#include "../../helpers/Format.hpp"
-CDMABuffer::CDMABuffer(uint32_t id, wl_client* client, SDMABUFAttrs attrs_) : attrs(attrs_) {
+CDMABuffer::CDMABuffer(uint32_t id, wl_client* client, SDMABUFAttrs const& attrs_) : attrs(attrs_) {
g_pHyprRenderer->makeEGLCurrent();
listeners.resourceDestroy = events.destroy.registerListener([this](std::any d) {
diff --git a/src/protocols/types/DMABuffer.hpp b/src/protocols/types/DMABuffer.hpp
index dac89493..d07840b7 100644
--- a/src/protocols/types/DMABuffer.hpp
+++ b/src/protocols/types/DMABuffer.hpp
@@ -4,7 +4,7 @@
class CDMABuffer : public IWLBuffer {
public:
- CDMABuffer(uint32_t id, wl_client* client, SDMABUFAttrs attrs_);
+ CDMABuffer(uint32_t id, wl_client* client, SDMABUFAttrs const& attrs_);
virtual ~CDMABuffer();
virtual eBufferCapability caps();