mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-15 12:03:48 -07:00
misc: constify the remaining for loops (#7534)
now we roll loops at blazing constified speed.
This commit is contained in:
@@ -19,7 +19,7 @@ CEventLoopManager::CEventLoopManager(wl_display* display, wl_event_loop* wlEvent
|
||||
}
|
||||
|
||||
CEventLoopManager::~CEventLoopManager() {
|
||||
for (auto& eventSource : m_sWayland.aqEventSources) {
|
||||
for (auto const& eventSource : m_sWayland.aqEventSources) {
|
||||
wl_event_source_remove(eventSource);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ void CEventLoopManager::enterLoop() {
|
||||
m_sWayland.eventSource = wl_event_loop_add_fd(m_sWayland.loop, m_sTimers.timerfd, WL_EVENT_READABLE, timerWrite, nullptr);
|
||||
|
||||
aqPollFDs = g_pCompositor->m_pAqBackend->getPollFDs();
|
||||
for (auto& fd : aqPollFDs) {
|
||||
for (auto const& fd : aqPollFDs) {
|
||||
m_sWayland.aqEventSources.emplace_back(wl_event_loop_add_fd(m_sWayland.loop, fd->fd, WL_EVENT_READABLE, aquamarineFDWrite, fd.get()));
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void CEventLoopManager::enterLoop() {
|
||||
}
|
||||
|
||||
void CEventLoopManager::onTimerFire() {
|
||||
for (auto& t : m_sTimers.timers) {
|
||||
for (auto const& t : m_sTimers.timers) {
|
||||
if (t.strongRef() > 1 /* if it's 1, it was lost. Don't call it. */ && t->passed() && !t->cancelled())
|
||||
t->call(t);
|
||||
}
|
||||
@@ -93,7 +93,7 @@ void CEventLoopManager::nudgeTimers() {
|
||||
|
||||
long nextTimerUs = 10 * 1000 * 1000; // 10s
|
||||
|
||||
for (auto& t : m_sTimers.timers) {
|
||||
for (auto const& t : m_sTimers.timers) {
|
||||
if (const auto µs = t->leftUs(); µs < nextTimerUs)
|
||||
nextTimerUs = µs;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ void CEventLoopManager::doLater(const std::function<void()>& fn) {
|
||||
auto cpy = IDLE->fns;
|
||||
IDLE->fns.clear();
|
||||
IDLE->eventSource = nullptr;
|
||||
for (auto& c : cpy) {
|
||||
for (auto const& c : cpy) {
|
||||
if (c)
|
||||
c();
|
||||
}
|
||||
|
Reference in New Issue
Block a user