mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
perf: use std::string_view for compile-time UserAgent (#3161)
This commit is contained in:
parent
0097921f42
commit
d1030b58b1
3 changed files with 4 additions and 4 deletions
|
@ -138,9 +138,9 @@ std::optional<std::string> tr_session::WebMediator::cookieFile() const
|
|||
return std::string{ path };
|
||||
}
|
||||
|
||||
std::optional<std::string> tr_session::WebMediator::userAgent() const
|
||||
std::optional<std::string_view> tr_session::WebMediator::userAgent() const
|
||||
{
|
||||
return fmt::format(FMT_STRING("{:s}/{:s}"), TR_NAME, SHORT_VERSION_STRING);
|
||||
return TR_NAME "/" SHORT_VERSION_STRING;
|
||||
}
|
||||
|
||||
std::optional<std::string> tr_session::WebMediator::publicAddress() const
|
||||
|
|
|
@ -396,7 +396,7 @@ public:
|
|||
|
||||
[[nodiscard]] std::optional<std::string> cookieFile() const override;
|
||||
[[nodiscard]] std::optional<std::string> publicAddress() const override;
|
||||
[[nodiscard]] std::optional<std::string> userAgent() const override;
|
||||
[[nodiscard]] std::optional<std::string_view> userAgent() const override;
|
||||
[[nodiscard]] unsigned int clamp(int bandwidth_tag, unsigned int byte_count) const override;
|
||||
void notifyBandwidthConsumed(int torrent_id, size_t byte_count) override;
|
||||
// runs the tr_web::fetch response callback in the libtransmission thread
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
}
|
||||
|
||||
// Return the preferred user aagent, or nullopt to not use one
|
||||
[[nodiscard]] virtual std::optional<std::string> userAgent() const
|
||||
[[nodiscard]] virtual std::optional<std::string_view> userAgent() const
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue