From ef9ece507205506f5694b9578cf89e9f4f0a43b2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 2 Jan 2024 13:31:23 +0000 Subject: Support moving buffer from unpackPqTextArray direct target list --- gentoobrowse-api/domain/converters.impl.h | 4 ++-- gentoobrowse-api/domain/unpackPqTextArray.h | 2 +- gentoobrowse-api/domain/unpackPqTextArray.ll | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gentoobrowse-api/domain/converters.impl.h b/gentoobrowse-api/domain/converters.impl.h index 10afa79..f6b6bad 100644 --- a/gentoobrowse-api/domain/converters.impl.h +++ b/gentoobrowse-api/domain/converters.impl.h @@ -10,7 +10,7 @@ namespace Slicer { UnpackPqTextArrayInto(std::istream & s, std::vector & l) : UnpackPqTextArray(s), list(l) { } void - consume(const std::string & s) override + consume(std::string s) override { if constexpr (std::is_arithmetic_v) { if (std::from_chars(s.c_str(), s.c_str() + s.length(), list.emplace_back()).ec != std::error_code {}) { @@ -18,7 +18,7 @@ namespace Slicer { } } else { - list.emplace_back(s); + list.emplace_back(std::move(s)); } } diff --git a/gentoobrowse-api/domain/unpackPqTextArray.h b/gentoobrowse-api/domain/unpackPqTextArray.h index 6e39f52..47c4cb7 100644 --- a/gentoobrowse-api/domain/unpackPqTextArray.h +++ b/gentoobrowse-api/domain/unpackPqTextArray.h @@ -14,7 +14,7 @@ namespace Slicer { int yylex() override; void LexerError(const char * msg) override; - virtual void consume(const std::string &) = 0; + virtual void consume(std::string) = 0; private: std::string buffer; diff --git a/gentoobrowse-api/domain/unpackPqTextArray.ll b/gentoobrowse-api/domain/unpackPqTextArray.ll index d2aca16..b24344d 100644 --- a/gentoobrowse-api/domain/unpackPqTextArray.ll +++ b/gentoobrowse-api/domain/unpackPqTextArray.ll @@ -11,6 +11,7 @@ #include "unpackPqTextArray.h" #include #include +#include class pqBaseFlexLexer; #pragma GCC diagnostic ignored "-Wconversion" @@ -57,7 +58,7 @@ char [^"] BEGIN(NEXT); } {quote} { - consume(buffer); + consume(std::move(buffer)); BEGIN(AFTER); } {esc} { -- cgit v1.2.3