summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHÃ¥vard Pettersen <havardpe@gmail.com>2018-11-09 12:33:53 +0100
committerGitHub <noreply@github.com>2018-11-09 12:33:53 +0100
commit2e592426dca1977700a2a8e87440d3ddc1df1b0d (patch)
tree32e3742a60273335115cacd09d9480311b2859fb
parent016cda7a01d90706f81593cb30fd64c08fd6713f (diff)
parenta71b19b554775b1a30038926fe1294462b59731e (diff)
Merge pull request #7607 from vespa-engine/balder/minor-code-cleanup-while-reading-code
Balder/minor code cleanup while reading code
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchers.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/fef/parametervalidator.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/thread.cpp12
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp4
4 files changed, 13 insertions, 13 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
index c2091410c16..a7df151f2f0 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchers.cpp
@@ -14,13 +14,13 @@ Matchers::Matchers(const vespalib::Clock &clock,
_default()
{ }
-Matchers::~Matchers() { }
+Matchers::~Matchers() = default;
void
Matchers::add(const vespalib::string &name, matching::Matcher::SP matcher)
{
_rpmap[name] = matcher;
- if (name == "default" || _default.get() == 0) {
+ if ((name == "default") || ! _default) {
_default = matcher;
}
}
@@ -29,8 +29,8 @@ matching::MatchingStats
Matchers::getStats() const
{
matching::MatchingStats stats;
- for (Map::const_iterator it(_rpmap.begin()), mt(_rpmap.end()); it != mt; it++) {
- stats.add(it->second->getStats());
+ for (const auto & entry : _rpmap) {
+ stats.add(entry.second->getStats());
}
return stats;
}
diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
index dda5ec0b719..b17592c8f74 100644
--- a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
+++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp
@@ -51,7 +51,7 @@ ParameterValidator::Result::Result(size_t tag) :
ParameterValidator::Result::Result(const Result &) = default;
ParameterValidator::Result & ParameterValidator::Result::operator=(const Result &) = default;
-ParameterValidator::Result::~Result() { }
+ParameterValidator::Result::~Result() = default;
void
ParameterValidator::validateField(ParameterType::Enum type,
diff --git a/vespalib/src/vespa/vespalib/util/thread.cpp b/vespalib/src/vespa/vespalib/util/thread.cpp
index d9341c7ec43..2d0118645ab 100644
--- a/vespalib/src/vespa/vespalib/util/thread.cpp
+++ b/vespalib/src/vespa/vespalib/util/thread.cpp
@@ -4,12 +4,12 @@
namespace vespalib {
-__thread Thread *Thread::_currentThread = 0;
+__thread Thread *Thread::_currentThread = nullptr;
void
Thread::Proxy::Run(FastOS_ThreadInterface *, void *)
{
- assert(_currentThread == 0);
+ assert(_currentThread == nullptr);
_currentThread = &thread;
start.await();
if (!cancel) {
@@ -17,10 +17,10 @@ Thread::Proxy::Run(FastOS_ThreadInterface *, void *)
runnable.run();
}
assert(_currentThread == &thread);
- _currentThread = 0;
+ _currentThread = nullptr;
}
-Thread::Proxy::~Proxy() { }
+Thread::Proxy::~Proxy() = default;
Thread::Thread(Runnable &runnable)
: _proxy(*this, runnable),
@@ -30,7 +30,7 @@ Thread::Thread(Runnable &runnable)
_woken(false)
{
FastOS_ThreadInterface *thread = _pool.NewThread(&_proxy);
- assert(thread != 0);
+ assert(thread != nullptr);
(void)thread;
}
@@ -80,7 +80,7 @@ Thread &
Thread::currentThread()
{
Thread *thread = _currentThread;
- assert(thread != 0);
+ assert(thread != nullptr);
return *thread;
}
diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
index 21d1de2a29b..ea657d4ec76 100644
--- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
+++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp
@@ -150,7 +150,7 @@ ThreadStackExecutorBase::start(uint32_t threads)
assert(threads > 0);
for (uint32_t i = 0; i < threads; ++i) {
FastOS_ThreadInterface *thread = _pool->NewThread(_thread_init.get());
- assert(thread != 0);
+ assert(thread != nullptr);
(void)thread;
}
}
@@ -200,7 +200,7 @@ ThreadStackExecutorBase::execute(Task::UP task)
} else {
++_stats.rejectedTasks;
}
- return std::move(task);
+ return task;
}
ThreadStackExecutorBase &