Avoid copies, fix warnings.
This commit is contained in:
parent
ef11508ca1
commit
e563731efe
@ -123,12 +123,11 @@ public:
|
|||||||
*
|
*
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
[[nodiscard]]
|
[[nodiscard]] inline string escape_url(const string_view url) const
|
||||||
inline string escape_url(const string_view url) const
|
|
||||||
{
|
{
|
||||||
char *cbuf{curl_easy_escape(_connection, url.data(),
|
char *cbuf{curl_easy_escape(_connection, url.data(),
|
||||||
static_cast<int>(url.size()))};
|
static_cast<int>(url.size()))};
|
||||||
const string sbuf{cbuf};
|
string sbuf{cbuf};
|
||||||
curl_free(cbuf);
|
curl_free(cbuf);
|
||||||
return sbuf;
|
return sbuf;
|
||||||
}
|
}
|
||||||
@ -145,12 +144,11 @@ public:
|
|||||||
*
|
*
|
||||||
* @since 0.3.0
|
* @since 0.3.0
|
||||||
*/
|
*/
|
||||||
[[nodiscard]]
|
[[nodiscard]] inline string unescape_url(const string_view url) const
|
||||||
inline string unescape_url(const string_view url) const
|
|
||||||
{
|
{
|
||||||
char *cbuf{curl_easy_unescape(_connection, url.data(),
|
char *cbuf{curl_easy_unescape(_connection, url.data(),
|
||||||
static_cast<int>(url.size()), nullptr)};
|
static_cast<int>(url.size()), nullptr)};
|
||||||
const string sbuf{cbuf};
|
string sbuf{cbuf};
|
||||||
curl_free(cbuf);
|
curl_free(cbuf);
|
||||||
return sbuf;
|
return sbuf;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ using std::string_view;
|
|||||||
//! @private
|
//! @private
|
||||||
constexpr auto shorten_filename(const string_view &filename)
|
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)};
|
const auto pos{filename.rfind(dir)};
|
||||||
if (pos != string_view::npos)
|
if (pos != string_view::npos)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user