aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-30 16:48:38 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-30 16:36:08 +0000
commit3b6e2a30e5f0174a963c36c85dc8867f1322d345 (patch)
tree06c7d80187c6ce20edc2dce8663b1b92443137f5
parent7e2200bf14e4dfc4fc65be154931e990912ca976 (diff)
libshiboken: Use empty() to check for empty containers as clang-tidy advises
Using the size() method for that purpose can be expensive for standard containers. Task-number: PYSIDE-727 Change-Id: I0da34e271503384a741d856fff5e84fee67bc97f Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp4
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index ec705a421..0aba26679 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -1531,7 +1531,7 @@ std::string info(SbkObject* self)
s << String::toCString(parent) << "\n";
}
- if (self->d->parentInfo && self->d->parentInfo->children.size()) {
+ if (self->d->parentInfo && !self->d->parentInfo->children.empty()) {
s << "children.......... ";
ChildrenList& children = self->d->parentInfo->children;
for (ChildrenList::const_iterator it = children.begin(); it != children.end(); ++it) {
@@ -1541,7 +1541,7 @@ std::string info(SbkObject* self)
s << '\n';
}
- if (self->d->referredObjects && self->d->referredObjects->size()) {
+ if (self->d->referredObjects && !self->d->referredObjects->empty()) {
Shiboken::RefCountMap& map = *self->d->referredObjects;
s << "referred objects.. ";
Shiboken::RefCountMap::const_iterator it = map.begin();
diff --git a/sources/shiboken2/libshiboken/bindingmanager.cpp b/sources/shiboken2/libshiboken/bindingmanager.cpp
index 2cc7847a8..0aa520b38 100644
--- a/sources/shiboken2/libshiboken/bindingmanager.cpp
+++ b/sources/shiboken2/libshiboken/bindingmanager.cpp
@@ -197,7 +197,7 @@ BindingManager::~BindingManager()
while (!m_d->wrapperMapper.empty()) {
Object::destroy(m_d->wrapperMapper.begin()->second, const_cast<void*>(m_d->wrapperMapper.begin()->first));
}
- assert(m_d->wrapperMapper.size() == 0);
+ assert(m_d->wrapperMapper.empty());
}
delete m_d;
}