1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 03:12:44 +00:00

refactor: add constexpr (#4514)

This commit is contained in:
Charles Kerr 2023-01-01 22:43:23 -06:00 committed by GitHub
parent 24eb6ef293
commit 806491232b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View file

@ -144,7 +144,7 @@ struct tau_scrape_request
} }
} }
[[nodiscard]] auto expiresAt() const noexcept [[nodiscard]] constexpr auto expiresAt() const noexcept
{ {
return created_at_ + TR_SCRAPE_TIMEOUT_SEC.count(); return created_at_ + TR_SCRAPE_TIMEOUT_SEC.count();
} }
@ -241,7 +241,7 @@ struct tau_announce_request
} }
} }
[[nodiscard]] auto expiresAt() const noexcept [[nodiscard]] constexpr auto expiresAt() const noexcept
{ {
return created_at_ + TR_ANNOUNCE_TIMEOUT_SEC.count(); return created_at_ + TR_ANNOUNCE_TIMEOUT_SEC.count();
} }

View file

@ -245,7 +245,7 @@ public:
easy_dispose(easy_); easy_dispose(easy_);
} }
[[nodiscard]] auto* easy() const [[nodiscard]] constexpr auto* easy() const
{ {
return easy_; return easy_;
} }
@ -255,42 +255,42 @@ public:
return options.buffer != nullptr ? options.buffer : privbuf.get(); return options.buffer != nullptr ? options.buffer : privbuf.get();
} }
[[nodiscard]] auto const& speedLimitTag() const [[nodiscard]] constexpr auto const& speedLimitTag() const
{ {
return options.speed_limit_tag; return options.speed_limit_tag;
} }
[[nodiscard]] auto const& url() const [[nodiscard]] constexpr auto const& url() const
{ {
return options.url; return options.url;
} }
[[nodiscard]] auto const& range() const [[nodiscard]] constexpr auto const& range() const
{ {
return options.range; return options.range;
} }
[[nodiscard]] auto const& cookies() const [[nodiscard]] constexpr auto const& cookies() const
{ {
return options.cookies; return options.cookies;
} }
[[nodiscard]] auto const& sndbuf() const [[nodiscard]] constexpr auto const& sndbuf() const
{ {
return options.sndbuf; return options.sndbuf;
} }
[[nodiscard]] auto const& rcvbuf() const [[nodiscard]] constexpr auto const& rcvbuf() const
{ {
return options.rcvbuf; return options.rcvbuf;
} }
[[nodiscard]] auto const& timeoutSecs() const [[nodiscard]] constexpr auto const& timeoutSecs() const
{ {
return options.timeout_secs; return options.timeout_secs;
} }
[[nodiscard]] auto ipProtocol() const [[nodiscard]] constexpr auto ipProtocol() const
{ {
switch (options.ip_proto) switch (options.ip_proto)
{ {

View file

@ -215,7 +215,7 @@ public:
return bandwidth_; return bandwidth_;
} }
[[nodiscard]] size_t activeReqCount(tr_direction dir) const noexcept override [[nodiscard]] TR_CONSTEXPR20 size_t activeReqCount(tr_direction dir) const noexcept override
{ {
if (dir == TR_CLIENT_TO_PEER) // blocks we've requested if (dir == TR_CLIENT_TO_PEER) // blocks we've requested
{ {