From c78338f2026ac7ca65f6172cb715c1f3a8749e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Lasersk=C3=B6ld?= Date: Wed, 22 Nov 2023 09:25:05 +0100 Subject: [PATCH] Possible performance improvements --- src/text/cursorrangeops.cpp | 2 +- src/text/fstring.cpp | 2 +- src/text/fstring.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/text/cursorrangeops.cpp b/src/text/cursorrangeops.cpp index 04c5618..39c5aef 100644 --- a/src/text/cursorrangeops.cpp +++ b/src/text/cursorrangeops.cpp @@ -15,7 +15,7 @@ std::vector contentLines(CursorRange range) { auto &buffer = begin.buffer(); if (begin.y() == end.y()) { - auto line = buffer.lineAt(begin.y()); + auto &line = buffer.lineAt(begin.y()); return {{line.begin() + begin.x(), line.begin() + end.x()}}; } diff --git a/src/text/fstring.cpp b/src/text/fstring.cpp index 35d5cef..41f9658 100644 --- a/src/text/fstring.cpp +++ b/src/text/fstring.cpp @@ -156,7 +156,7 @@ std::vector FString::split(Utf8Char c) const { return ret; } -FString FString::join(std::vector strings, Utf8Char c) { +FString FString::join(const std::vector &strings, Utf8Char c) { size_t size = strings.size() - 1; diff --git a/src/text/fstring.h b/src/text/fstring.h index c59f79d..f9dfd63 100644 --- a/src/text/fstring.h +++ b/src/text/fstring.h @@ -164,7 +164,7 @@ class FString { std::vector split(Utf8Char c = '\n') const; - static FString join(std::vector strings, Utf8Char c = '\n'); + static FString join(const std::vector &strings, Utf8Char c = '\n'); FString operator+(const FString &other);