diff options
author | tastytea | 2020-11-13 12:01:18 +0100 |
---|---|---|
committer | tastytea | 2020-11-13 12:01:18 +0100 |
commit | e563731efebad63c1478e6368557a7f9c37803fb (patch) | |
tree | ad9f0c922faa6c680af99911813373b4690c4830 | |
parent | ef11508ca1500adbcf23b2e84e1034eaa24c94d6 (diff) | |
download | mastodonpp-e563731efebad63c1478e6368557a7f9c37803fb.tar mastodonpp-e563731efebad63c1478e6368557a7f9c37803fb.tar.gz mastodonpp-e563731efebad63c1478e6368557a7f9c37803fb.zip |
Avoid copies, fix warnings.
-rw-r--r-- | include/curl_wrapper.hpp | 10 | ||||
-rw-r--r-- | 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<int>(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<int>(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) |