summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-08-27 13:06:15 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-08-27 13:06:35 +0200
commit033ce593af9b1505c804930c84297f1da26858c4 (patch)
treedb3faf35bc9632b3a59f3c76ede46a16aadbec9f
parent1e8b7cdbbd084a1e75f82bfff605321c8480b78d (diff)
Simplify hasModifications check
Change-Id: Idcbd9a20ab13d0717f8728673e2c55e87aa92be4
-rw-r--r--configmgr/source/components.cxx13
-rw-r--r--configmgr/source/components.hxx2
-rw-r--r--configmgr/source/modifications.hxx2
3 files changed, 5 insertions, 12 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 6c2726e8a6c8..b3c8acb71c92 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -277,18 +277,11 @@ void Components::addModification(Path const & path) {
data_.modifications.add(path);
}
-bool Components::hasModifications() const
-{
- return data_.modifications.getRoot().children.begin() !=
- data_.modifications.getRoot().children.end();
-}
-
void Components::writeModifications() {
- if (!hasModifications() || modificationFileUrl_.isEmpty())
- return;
-
- if (!writeThread_.is()) {
+ if (!(data_.modifications.empty() || modificationFileUrl_.isEmpty()
+ || writeThread_.is()))
+ {
writeThread_ = new WriteThread(
&writeThread_, *this, modificationFileUrl_, data_);
writeThread_->launch();
diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx
index f43181f18f9d..25d0d6e05cfc 100644
--- a/configmgr/source/components.hxx
+++ b/configmgr/source/components.hxx
@@ -78,8 +78,6 @@ public:
void writeModifications();
- bool hasModifications() const;
-
void flushModifications();
// must be called with configmgr::lock unaquired; must be called before
// shutdown if writeModifications has ever been called (probably
diff --git a/configmgr/source/modifications.hxx b/configmgr/source/modifications.hxx
index 71e06ea8f178..04ad5c34d72e 100644
--- a/configmgr/source/modifications.hxx
+++ b/configmgr/source/modifications.hxx
@@ -45,6 +45,8 @@ public:
void remove(Path const & path);
+ bool empty() const { return root_.children.empty(); }
+
Node const & getRoot() const { return root_;}
private: