From 907d7f8f59e2fbc3b2a412453f08c0e1e5ed124c Mon Sep 17 00:00:00 2001 From: edding3000 Date: Thu, 20 Nov 2025 15:24:05 +0100 Subject: [PATCH 1/2] Use reference in range-based for loop --- src/rules_exceptions.cc | 4 ++-- src/transaction.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rules_exceptions.cc b/src/rules_exceptions.cc index 2fb0cf857f..e448256cda 100644 --- a/src/rules_exceptions.cc +++ b/src/rules_exceptions.cc @@ -195,7 +195,7 @@ bool RulesExceptions::contains(int a) { } } - for (auto z : m_ranges) { + for (auto& z : m_ranges) { if (z.first <= a && z.second >= a) { return true; } @@ -212,7 +212,7 @@ bool RulesExceptions::merge(RulesExceptions *from) { return ret; } } - for (auto b : from->m_ranges) { + for (auto& b : from->m_ranges) { bool ret = addRange(b.first, b.second); if (ret == false) { return ret; diff --git a/src/transaction.cc b/src/transaction.cc index 6c8ae9744c..db3a4040cc 100644 --- a/src/transaction.cc +++ b/src/transaction.cc @@ -1700,7 +1700,7 @@ std::string Transaction::toJSON(int parts) { reinterpret_cast("messages"), strlen("messages")); yajl_gen_array_open(g); - for (auto a : m_rulesMessages) { + for (auto& a : m_rulesMessages) { yajl_gen_map_open(g); LOGFY_ADD("message", a.m_message); yajl_gen_string(g, @@ -1721,7 +1721,7 @@ std::string Transaction::toJSON(int parts) { reinterpret_cast("tags"), strlen("tags")); yajl_gen_array_open(g); - for (auto b : a.m_tags) { + for (auto& b : a.m_tags) { yajl_gen_string(g, reinterpret_cast(b.data()), b.length()); From 12671d1f55e3a6449b06d1db7c72e3a25a94d19a Mon Sep 17 00:00:00 2001 From: edding3000 Date: Thu, 20 Nov 2025 15:24:41 +0100 Subject: [PATCH 2/2] Use explicit '*' with auto for pointers --- src/engine/lua.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/lua.cc b/src/engine/lua.cc index 9313a2ec7f..869acefd4b 100644 --- a/src/engine/lua.cc +++ b/src/engine/lua.cc @@ -297,7 +297,7 @@ int Lua::getvars(lua_State *L) { variables::Variable::stringMatchResolveMulti(t, varname, &l); lua_newtable(L); - for (auto i : l) { + for (auto* i : l) { lua_pushnumber(L, idx); lua_newtable(L);