From 40483d84784f6f050d4a897134a528cde499b8ff Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Tue, 7 Sep 2021 20:51:41 -0700
Subject: [PATCH] fix wrong emplace usage

emplace already calls std::pair. No need for it again.

No need to emplace when calling std::make_shared.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 src/neighbor/plugins/UdisksNeighborPlugin.cxx        | 4 ++--
 src/output/MultipleOutputs.cxx                       | 5 ++---
 src/output/plugins/snapcast/SnapcastOutputPlugin.cxx | 2 +-
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/neighbor/plugins/UdisksNeighborPlugin.cxx b/src/neighbor/plugins/UdisksNeighborPlugin.cxx
index f5274e04f..b980e6d3e 100644
--- a/src/neighbor/plugins/UdisksNeighborPlugin.cxx
+++ b/src/neighbor/plugins/UdisksNeighborPlugin.cxx
@@ -193,11 +193,11 @@ UdisksNeighborExplorer::Insert(UDisks2::Object &&o) noexcept
 
 	{
 		const std::lock_guard<Mutex> protect(mutex);
-		auto i = by_uri.emplace(std::make_pair(o.GetUri(), info));
+		auto i = by_uri.emplace(o.GetUri(), info);
 		if (!i.second)
 			i.first->second = info;
 
-		by_path.emplace(std::make_pair(o.path, i.first));
+		by_path.emplace(o.path, i.first);
 		// TODO: do we need to remove a conflicting path?
 	}
 
diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx
index 88c7d98d1..ab9d3c66f 100644
--- a/src/output/MultipleOutputs.cxx
+++ b/src/output/MultipleOutputs.cxx
@@ -134,7 +134,7 @@ MultipleOutputs::Add(std::unique_ptr<FilteredAudioOutput> output,
 		     bool enable) noexcept
 {
 	// TODO: this operation needs to be protected with a mutex
-	outputs.emplace_back(std::make_unique<AudioOutputControl>(std::move(output),
+	outputs.push_back(std::make_unique<AudioOutputControl>(std::move(output),
 								  client));
 
 	outputs.back()->LockSetEnabled(enable);
@@ -147,8 +147,7 @@ MultipleOutputs::AddCopy(AudioOutputControl *outputControl,
 		     bool enable) noexcept
 {
 	// TODO: this operation needs to be protected with a mutex
-	outputs.emplace_back(std::make_unique<AudioOutputControl>(outputControl,
-								  client));
+	outputs.push_back(std::make_unique<AudioOutputControl>(outputControl, client));
 
 	outputs.back()->LockSetEnabled(enable);
 
diff --git a/src/output/plugins/snapcast/SnapcastOutputPlugin.cxx b/src/output/plugins/snapcast/SnapcastOutputPlugin.cxx
index b6fd6f844..522943939 100644
--- a/src/output/plugins/snapcast/SnapcastOutputPlugin.cxx
+++ b/src/output/plugins/snapcast/SnapcastOutputPlugin.cxx
@@ -346,7 +346,7 @@ SnapcastOutput::Play(const void *chunk, size_t size)
 			inject_event.Schedule();
 
 		const ConstBuffer payload{buffer, nbytes};
-		chunks.emplace(std::make_shared<SnapcastChunk>(now, AllocatedArray{payload}));
+		chunks.push(std::make_shared<SnapcastChunk>(now, AllocatedArray{payload}));
 	}
 
 	return size;