From c6c7191b16e4f5422c19b640b236b4b15a45d99d Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 30 May 2024 19:14:01 +0100 Subject: [PATCH] Avoid unnecessary allocation of temporaries in layout line cache --- src/gfx_layout.cpp | 2 +- src/gfx_layout.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index a83513977f..91898a4bf6 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -389,7 +389,7 @@ Layouter::LineCacheItem &Layouter::GetCachedParagraphLayout(std::string_view str LineCacheKey key; key.state_before = state; key.str.assign(str); - return (*linecache)[key]; + return (*linecache)[std::move(key)]; } /** diff --git a/src/gfx_layout.h b/src/gfx_layout.h index cda0ffd2ae..7621d06707 100644 --- a/src/gfx_layout.h +++ b/src/gfx_layout.h @@ -138,7 +138,7 @@ class Layouter : public std::vector