From 08cca705a8034be9c04461f017b40a1ac98c5748 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 26 Aug 2022 16:53:56 +0200 Subject: [PATCH] Avoid copying local variables if possible --- lib/icinga/scheduleddowntime.cpp | 4 ++-- lib/remote/httphandler.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/icinga/scheduleddowntime.cpp b/lib/icinga/scheduleddowntime.cpp index 972a428ad..140a64df7 100644 --- a/lib/icinga/scheduleddowntime.cpp +++ b/lib/icinga/scheduleddowntime.cpp @@ -171,7 +171,7 @@ std::pair ScheduledDowntime::FindRunningSegment(double minEnd) if (!bestSegment || end > bestEnd) { Log(LogDebug, "ScheduledDowntime") << "(best match yet)"; - bestSegment = segment; + bestSegment = std::move(segment); bestBegin = begin; bestEnd = end; } @@ -227,7 +227,7 @@ std::pair ScheduledDowntime::FindNextSegment() if (!bestSegment || begin < bestBegin) { Log(LogDebug, "ScheduledDowntime") << "(best match yet)"; - bestSegment = segment; + bestSegment = std::move(segment); bestBegin = begin; bestEnd = end; } diff --git a/lib/remote/httphandler.cpp b/lib/remote/httphandler.cpp index afe510fb8..dfb94ecc2 100644 --- a/lib/remote/httphandler.cpp +++ b/lib/remote/httphandler.cpp @@ -33,7 +33,7 @@ void HttpHandler::Register(const Url::Ptr& url, const HttpHandler::Ptr& handler) children->Set(elem, sub_node); } - node = sub_node; + node = std::move(sub_node); } Array::Ptr handlers = node->Get("handlers");