Browse Source

Replace Q_UNLIKELY with [[unlikely]] attribute

PR #19445.
adaptive-webui-19844
Victor Chernyakin 1 year ago committed by GitHub
parent
commit
850da9dd83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/base/bittorrent/sessionimpl.cpp
  2. 2
      src/gui/addnewtorrentdialog.cpp

2
src/base/bittorrent/sessionimpl.cpp

@ -3003,7 +3003,7 @@ void SessionImpl::invokeAsync(std::function<void ()> func)
bool SessionImpl::downloadMetadata(const TorrentDescriptor &torrentDescr) bool SessionImpl::downloadMetadata(const TorrentDescriptor &torrentDescr)
{ {
Q_ASSERT(!torrentDescr.info().has_value()); Q_ASSERT(!torrentDescr.info().has_value());
if (Q_UNLIKELY(torrentDescr.info().has_value())) if (torrentDescr.info().has_value()) [[unlikely]]
return false; return false;
const InfoHash infoHash = torrentDescr.infoHash(); const InfoHash infoHash = torrentDescr.infoHash();

2
src/gui/addnewtorrentdialog.cpp

@ -692,7 +692,7 @@ void AddNewTorrentDialog::contentLayoutChanged()
void AddNewTorrentDialog::saveTorrentFile() void AddNewTorrentDialog::saveTorrentFile()
{ {
Q_ASSERT(hasMetadata()); Q_ASSERT(hasMetadata());
if (Q_UNLIKELY(!hasMetadata())) if (!hasMetadata()) [[unlikely]]
return; return;
const auto torrentInfo = *m_torrentDescr.info(); const auto torrentInfo = *m_torrentDescr.info();

Loading…
Cancel
Save