summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-08-05 14:27:30 +0200
committerMax Kellermann <max@musicpd.org>2021-08-05 14:28:37 +0200
commit96875921b72949592ce4fa07a5618df80b668443 (patch)
treed1d1ae9d05fe6e760f57f18ba1568e4e85cef8ad
parent551c941b5a5cd9beea2e2970103839d5535e2d11 (diff)
tag/Builder: use std::swap() in move operator
This way, we save the overhead for acquiring the tag_pool_lock.
-rw-r--r--src/tag/Builder.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tag/Builder.cxx b/src/tag/Builder.cxx
index 76b404499..e5e380399 100644
--- a/src/tag/Builder.cxx
+++ b/src/tag/Builder.cxx
@@ -78,11 +78,14 @@ TagBuilder::operator=(const TagBuilder &other) noexcept
TagBuilder &
TagBuilder::operator=(TagBuilder &&other) noexcept
{
+ using std::swap;
+
duration = other.duration;
has_playlist = other.has_playlist;
- RemoveAll();
- items = std::move(other.items);
+ /* swap the two TagItem lists so we don't need to touch the
+ tag pool just yet */
+ swap(items, other.items);
return *this;
}