Simplify hasModifications check
Change-Id: Idcbd9a20ab13d0717f8728673e2c55e87aa92be4
This commit is contained in:
@@ -277,18 +277,11 @@ void Components::addModification(Path const & path) {
|
|||||||
data_.modifications.add(path);
|
data_.modifications.add(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Components::hasModifications() const
|
|
||||||
{
|
|
||||||
return data_.modifications.getRoot().children.begin() !=
|
|
||||||
data_.modifications.getRoot().children.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Components::writeModifications() {
|
void Components::writeModifications() {
|
||||||
|
|
||||||
if (!hasModifications() || modificationFileUrl_.isEmpty())
|
if (!(data_.modifications.empty() || modificationFileUrl_.isEmpty()
|
||||||
return;
|
|| writeThread_.is()))
|
||||||
|
{
|
||||||
if (!writeThread_.is()) {
|
|
||||||
writeThread_ = new WriteThread(
|
writeThread_ = new WriteThread(
|
||||||
&writeThread_, *this, modificationFileUrl_, data_);
|
&writeThread_, *this, modificationFileUrl_, data_);
|
||||||
writeThread_->launch();
|
writeThread_->launch();
|
||||||
|
@@ -78,8 +78,6 @@ public:
|
|||||||
|
|
||||||
void writeModifications();
|
void writeModifications();
|
||||||
|
|
||||||
bool hasModifications() const;
|
|
||||||
|
|
||||||
void flushModifications();
|
void flushModifications();
|
||||||
// must be called with configmgr::lock unaquired; must be called before
|
// must be called with configmgr::lock unaquired; must be called before
|
||||||
// shutdown if writeModifications has ever been called (probably
|
// shutdown if writeModifications has ever been called (probably
|
||||||
|
@@ -45,6 +45,8 @@ public:
|
|||||||
|
|
||||||
void remove(Path const & path);
|
void remove(Path const & path);
|
||||||
|
|
||||||
|
bool empty() const { return root_.children.empty(); }
|
||||||
|
|
||||||
Node const & getRoot() const { return root_;}
|
Node const & getRoot() const { return root_;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user