From e563731efebad63c1478e6368557a7f9c37803fb Mon Sep 17 00:00:00 2001 From: tastytea Date: Fri, 13 Nov 2020 12:01:18 +0100 Subject: Avoid copies, fix warnings. --- include/curl_wrapper.hpp | 10 ++++------ src/log.hpp | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/curl_wrapper.hpp b/include/curl_wrapper.hpp index ffe0876..52af3b2 100644 --- a/include/curl_wrapper.hpp +++ b/include/curl_wrapper.hpp @@ -123,12 +123,11 @@ public: * * @since 0.3.0 */ - [[nodiscard]] - inline string escape_url(const string_view url) const + [[nodiscard]] inline string escape_url(const string_view url) const { char *cbuf{curl_easy_escape(_connection, url.data(), static_cast(url.size()))}; - const string sbuf{cbuf}; + string sbuf{cbuf}; curl_free(cbuf); return sbuf; } @@ -145,12 +144,11 @@ public: * * @since 0.3.0 */ - [[nodiscard]] - inline string unescape_url(const string_view url) const + [[nodiscard]] inline string unescape_url(const string_view url) const { char *cbuf{curl_easy_unescape(_connection, url.data(), static_cast(url.size()), nullptr)}; - const string sbuf{cbuf}; + string sbuf{cbuf}; curl_free(cbuf); return sbuf; } diff --git a/src/log.hpp b/src/log.hpp index 151d799..8f74847 100644 --- a/src/log.hpp +++ b/src/log.hpp @@ -29,7 +29,7 @@ using std::string_view; //! @private constexpr auto shorten_filename(const string_view &filename) { - for (const string_view &dir : {"/src/", "/include/"}) + for (const string_view dir : {"/src/", "/include/"}) { const auto pos{filename.rfind(dir)}; if (pos != string_view::npos) -- cgit v1.2.3-54-g00ecf