From 1e57387c1390e09b6a66de98011897ddd229236f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 11 Aug 2022 20:37:54 +0100 Subject: Use stringstream str by move --- gentoobrowse-api/domain/converters.impl.h | 2 +- gentoobrowse-api/service/xsltStreamSerializer.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gentoobrowse-api/domain/converters.impl.h b/gentoobrowse-api/domain/converters.impl.h index 38a674e..ebff336 100644 --- a/gentoobrowse-api/domain/converters.impl.h +++ b/gentoobrowse-api/domain/converters.impl.h @@ -68,6 +68,6 @@ namespace Slicer { } } ss << "}"; - return ss.str(); + return std::move(ss).str(); } } diff --git a/gentoobrowse-api/service/xsltStreamSerializer.cpp b/gentoobrowse-api/service/xsltStreamSerializer.cpp index acb5750..9d453ac 100644 --- a/gentoobrowse-api/service/xsltStreamSerializer.cpp +++ b/gentoobrowse-api/service/xsltStreamSerializer.cpp @@ -62,7 +62,7 @@ namespace Gentoo { xmlOutputBufferClose(buf); return std::make_shared(Headers {}, "related", Parts { - std::make_shared(Headers {}, "text/html", strm.str()), + std::make_shared(Headers {}, "text/html", std::move(strm).str()), std::make_shared( Headers { {"Content-Id", ""}, @@ -74,7 +74,6 @@ namespace Gentoo { IceTray::Mime::BasicPartPtr XsltStreamSerializer::getText(xmlDoc * result) { - std::stringstream strm; std::vector callLynx { "/usr/bin/lynx", "-dump", @@ -88,6 +87,7 @@ namespace Gentoo { fclose(lynxIn); std::array buf {}; ssize_t r; + std::stringstream strm; while ((r = read(fds.fdOut(), buf.data(), buf.size())) > 0) { strm.write(buf.data(), r); } @@ -96,6 +96,6 @@ namespace Gentoo { if (status != 0) { throw std::runtime_error("Lynx failed"); } - return std::make_shared(Headers {}, "text/plain", strm.str()); + return std::make_shared(Headers {}, "text/plain", std::move(strm).str()); } } -- cgit v1.2.3