From c4e25b899cc3f934d30c24d8ab4a2808ef9dac2c Mon Sep 17 00:00:00 2001 From: kamel5 Date: Wed, 10 Jul 2019 14:55:14 +0200 Subject: [PATCH] Rework cRecManager::WhatsOnNow --- recmanager.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/recmanager.c b/recmanager.c index c92e2a9..b2140b6 100644 --- a/recmanager.c +++ b/recmanager.c @@ -781,31 +781,23 @@ const cEvent **cRecManager::WhatsOnNow(bool nowOrNext, int &numResults) { std::vector tmpResults; #if VDRVERSNUM >= 20301 LOCK_CHANNELS_READ; + const cChannels* channels = Channels; LOCK_SCHEDULES_READ; const cSchedules* schedules = Schedules; #else + cChannels* channels = &Channels; cSchedulesLock schedulesLock; const cSchedules *schedules = cSchedules::Schedules(schedulesLock); #endif const cChannel *startChannel = NULL, *stopChannel = NULL; if (tvguideConfig.favLimitChannels) { -#if VDRVERSNUM >= 20301 - startChannel = Channels->GetByNumber(tvguideConfig.favStartChannel); - stopChannel = Channels->GetByNumber(tvguideConfig.favStopChannel); + startChannel = channels->GetByNumber(tvguideConfig.favStartChannel); + stopChannel = channels->GetByNumber(tvguideConfig.favStopChannel); } if (!startChannel) - startChannel = Channels->First(); + startChannel = channels->First(); - for (const cChannel *channel = startChannel; channel; channel = Channels->Next(channel)) { -#else - startChannel = Channels.GetByNumber(tvguideConfig.favStartChannel); - stopChannel = Channels.GetByNumber(tvguideConfig.favStopChannel); - } - if (!startChannel) - startChannel = Channels.First(); - - for (const cChannel *channel = startChannel; channel; channel = Channels.Next(channel)) { -#endif + for (const cChannel *channel = startChannel; channel; channel = channels->Next(channel)) { if (channel->GroupSep()) continue; const cSchedule *Schedule = schedules->GetSchedule(channel); if (!Schedule) continue;