Skip to content

Commit

Permalink
Generally empty()/isEmpty() is more efficient than using size()
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Feb 16, 2013
1 parent 6ec1bda commit 93dae11
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mythnetvision/mythnetvision/nettree.cpp
Expand Up @@ -1199,7 +1199,7 @@ void NetTree::TreeRefresh()

void NetTree::updateRSS()
{
if (!findAllDBRSS().count())
if (findAllDBRSS().isEmpty())
return;

QString title(tr("Updating RSS. This could take a while..."));
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/mythrssmanager.cpp
Expand Up @@ -95,7 +95,7 @@ void RSSManager::processAndInsertRSS(RSSSite *site)
m_inprogress.removeOne(site);
}

if (!m_inprogress.count())
if (m_inprogress.isEmpty())
emit finished();
}

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/cardutil.cpp
Expand Up @@ -1859,7 +1859,7 @@ InputNames CardUtil::ProbeV4LVideoInputs(int videofd, bool &ok)
#endif // USING_V4L1

// Create an input on single input cards that don't advertise input
if (!list.size())
if (list.isEmpty())
list[0] = "Television";

ok = true;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/eithelper.cpp
Expand Up @@ -71,7 +71,7 @@ uint EITHelper::ProcessEvents(void)
QMutexLocker locker(&eitList_lock);
uint insertCount = 0;

if (!db_events.size())
if (db_events.empty())
return 0;

MSqlQuery query(MSqlQuery::InitCon());
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/eitscanner.cpp
Expand Up @@ -228,7 +228,7 @@ void EITScanner::StartActiveScan(TVRec *_rec, uint max_seconds_per_source)
{
rec = _rec;

if (!activeScanChannels.size())
if (activeScanChannels.isEmpty())
{
// TODO get input name and use it in crawl.
MSqlQuery query(MSqlQuery::InitCon());
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/osd.cpp
Expand Up @@ -182,7 +182,7 @@ bool OSD::Init(const QRect &rect, float font_aspect)
LoadWindows();
RevertUIScale();

if (!m_Children.size())
if (m_Children.isEmpty())
{
LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to load any windows.");
return false;
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/programdata.cpp
Expand Up @@ -356,11 +356,11 @@ static int score_match(const QString &a, const QString &b)

QStringList al, bl;
al = A.split(" ", QString::SkipEmptyParts);
if (!al.size())
if (al.isEmpty())
return 0;

bl = B.split(" ", QString::SkipEmptyParts);
if (!bl.size())
if (bl.isEmpty())
return 0;

// score words symmetrically
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/recorders/channelbase.cpp
Expand Up @@ -267,7 +267,7 @@ uint ChannelBase::GetNextChannel(const QString &channum, int direction) const
int ChannelBase::GetNextInputNum(void) const
{
// Exit early if inputs don't exist..
if (!m_inputs.size())
if (m_inputs.isEmpty())
return -1;

// Find current input
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/util-xv.cpp
Expand Up @@ -117,7 +117,7 @@ void del_open_xv_port(int port)
{
open_xv_ports.remove(port);

if (!open_xv_ports.count())
if (open_xv_ports.isEmpty())
{
SignalHandler::SetHandler(SIGINT, NULL);
SignalHandler::SetHandler(SIGTERM, NULL);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/videoout_vdpau.cpp
Expand Up @@ -268,7 +268,7 @@ bool VideoOutputVDPAU::CreateVideoSurfaces(uint num)

void VideoOutputVDPAU::DeleteVideoSurfaces(void)
{
if (!m_render || !m_video_surfaces.size())
if (!m_render || m_video_surfaces.isEmpty())
return;

for (int i = 0; i < m_video_surfaces.size(); i++)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythui/mythuieditbar.cpp
Expand Up @@ -119,7 +119,7 @@ void MythUIEditBar::Display(void)

ClearImages();

if (!m_regions.size())
if (m_regions.isEmpty())
{
if (keep)
keep->SetVisible(true);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/guidegrid.cpp
Expand Up @@ -174,7 +174,7 @@ void GuideGrid::RunProgramGuide(uint chanid, const QString &channum,
// check there are some channels setup
ChannelInfoList channels = ChannelUtil::GetChannels(
0, true, "", (changrpid<0) ? 0 : changrpid);
if (!channels.size())
if (channels.empty())
{
QString message;
if (changrpid == -1)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/scheduleeditor.cpp
Expand Up @@ -1714,7 +1714,7 @@ void MetadataOptions::HandleDownloadedImages(MetadataLookup *lookup)

DownloadMap map = lookup->GetDownloads();

if (!map.size())
if (map.isEmpty())
return;

for (DownloadMap::const_iterator i = map.begin(); i != map.end(); ++i)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/videolist.cpp
Expand Up @@ -1013,7 +1013,7 @@ void VideoListImp::buildDbList()

QStringList dirs = GetVideoDirs();

if (!dirs.size())
if (dirs.isEmpty())
return;

QString test_prefix(dirs[0]);
Expand Down

0 comments on commit 93dae11

Please sign in to comment.