refactor: use std::ranges whenever possible (#10584)
This commit is contained in:
parent
9bf1b49144
commit
9190443d95
50 changed files with 137 additions and 146 deletions
|
|
@ -33,8 +33,7 @@ CXDGActivationToken::CXDGActivationToken(SP<CXdgActivationTokenV1> resource_) :
|
|||
|
||||
PROTO::activation->m_sentTokens.push_back({m_token, m_resource->client()});
|
||||
|
||||
auto count = std::count_if(PROTO::activation->m_sentTokens.begin(), PROTO::activation->m_sentTokens.end(),
|
||||
[this](const auto& other) { return other.client == m_resource->client(); });
|
||||
auto count = std::ranges::count_if(PROTO::activation->m_sentTokens, [this](const auto& other) { return other.client == m_resource->client(); });
|
||||
|
||||
if UNLIKELY (count > 10) {
|
||||
// remove first token. Too many, dear app.
|
||||
|
|
@ -68,7 +67,7 @@ void CXDGActivationProtocol::bindManager(wl_client* client, void* data, uint32_t
|
|||
RESOURCE->setDestroy([this](CXdgActivationV1* pMgr) { this->onManagerResourceDestroy(pMgr->resource()); });
|
||||
RESOURCE->setGetActivationToken([this](CXdgActivationV1* pMgr, uint32_t id) { this->onGetToken(pMgr, id); });
|
||||
RESOURCE->setActivate([this](CXdgActivationV1* pMgr, const char* token, wl_resource* surface) {
|
||||
auto TOKEN = std::find_if(m_sentTokens.begin(), m_sentTokens.end(), [token](const auto& t) { return t.token == token; });
|
||||
auto TOKEN = std::ranges::find_if(m_sentTokens, [token](const auto& t) { return t.token == token; });
|
||||
|
||||
if UNLIKELY (TOKEN == m_sentTokens.end()) {
|
||||
LOGM(WARN, "activate event for non-existent token {}??", token);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue