Remove unnecessary std::move
Moving a temporary object prevents copy elision, and could reduce
performance.
This fixes -Wpessimizing-move compiler warning.
Test: presubmit
Bug: 154270751
Change-Id: Ia0b02d90c239572c953007272f75900ee77c6305
diff --git a/media/codec2/hal/common/MultiAccessUnitHelper.cpp b/media/codec2/hal/common/MultiAccessUnitHelper.cpp
index 55bf7a9..b287b91 100644
--- a/media/codec2/hal/common/MultiAccessUnitHelper.cpp
+++ b/media/codec2/hal/common/MultiAccessUnitHelper.cpp
@@ -327,10 +327,10 @@
newWork->worklets.front()->component = inWork->worklets.front()->component;
std::vector<std::unique_ptr<C2Tuning>> tunings;
for (std::unique_ptr<C2Tuning>& tuning : inWork->worklets.front()->tunings) {
- tunings.push_back(std::move(
+ tunings.push_back(
std::unique_ptr<C2Tuning>(
static_cast<C2Tuning*>(
- C2Param::Copy(*(tuning.get())).release()))));
+ C2Param::Copy(*(tuning.get())).release())));
}
newWork->worklets.front()->tunings = std::move(tunings);
}
@@ -344,7 +344,7 @@
<< inputOrdinal.frameIndex.peekull()
<< ") -> newFrameIndex " << newFrameIdx
<<" : input ts " << inputOrdinal.timestamp.peekull();
- sliceWork.push_back(std::move(cloneInputWork(w, w->input.flags)));
+ sliceWork.push_back(cloneInputWork(w, w->input.flags));
if (!w->input.buffers.empty() && w->input.buffers.front() != nullptr) {
sliceWork.back()->input.buffers = std::move(w->input.buffers);
}
@@ -853,4 +853,4 @@
mLargeWork.reset();
}
-} // namespace android
\ No newline at end of file
+} // namespace android
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 04364a8..717106b 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -487,7 +487,7 @@
.id = getId(mClient),
.name = mCodecName,
.importance = mImportance};
- return std::move(clientInfo);
+ return clientInfo;
}
private:
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 1f4e16e..3ef23e4 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -4491,7 +4491,7 @@
// TODO(b/184194057): Use the vibrator information from the vibrator that will be used
// for the HapticGenerator.
const std::optional<media::AudioVibratorInfo> defaultVibratorInfo =
- std::move(getDefaultVibratorInfo_l());
+ getDefaultVibratorInfo_l();
if (defaultVibratorInfo) {
// Only set the vibrator info when it is a valid one.
audio_utils::lock_guard _cl(chain->mutex());
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index a9fd5ea..89a3951 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1695,7 +1695,7 @@
// TODO(b/184194057): Use the vibrator information from the vibrator that will be used
// for the HapticGenerator.
const std::optional<media::AudioVibratorInfo> defaultVibratorInfo =
- std::move(mAfThreadCallback->getDefaultVibratorInfo_l());
+ mAfThreadCallback->getDefaultVibratorInfo_l();
if (defaultVibratorInfo) {
audio_utils::lock_guard _cl(chain->mutex());
// Only set the vibrator info when it is a valid one.
@@ -2916,7 +2916,7 @@
// TODO(b/184194780): Use the vibrator information from the vibrator that will be
// used to play this track.
audio_utils::lock_guard _l(mAfThreadCallback->mutex());
- vibratorInfo = std::move(mAfThreadCallback->getDefaultVibratorInfo_l());
+ vibratorInfo = mAfThreadCallback->getDefaultVibratorInfo_l();
}
mutex().lock();
track->setHapticScale(hapticScale);
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 2d55f39..d99962d 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -1570,7 +1570,7 @@
s << ", " << std::to_string(i);
}
}
- return std::move(s.str());
+ return s.str();
}
int32_t CameraService::mapToInterface(TorchModeStatus status) {
@@ -5155,7 +5155,7 @@
}
if (hasAny) ret << "\n";
ret << "]\n";
- return std::move(ret.str());
+ return ret.str();
}
CameraService::DescriptorPtr CameraService::CameraClientManager::makeClientDescriptor(
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index caa6424..6347863 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -419,7 +419,7 @@
result << " none\n";
}
- std::string resultStr = std::move(result.str());
+ std::string resultStr = result.str();
write(fd, resultStr.c_str(), resultStr.size());
diff --git a/services/camera/libcameraservice/device3/Camera3BufferManager.cpp b/services/camera/libcameraservice/device3/Camera3BufferManager.cpp
index c42e51a..65fee7d 100644
--- a/services/camera/libcameraservice/device3/Camera3BufferManager.cpp
+++ b/services/camera/libcameraservice/device3/Camera3BufferManager.cpp
@@ -485,7 +485,7 @@
streamId, bufferCount);
}
}
- std::string linesStr = std::move(lines.str());
+ std::string linesStr = lines.str();
write(fd, linesStr.c_str(), linesStr.size());
}
diff --git a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
index 152687e..13b97b6 100644
--- a/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
+++ b/services/camera/libcameraservice/device3/Camera3IOStreamBase.cpp
@@ -104,7 +104,7 @@
lines << fmt::sprintf(" Total buffers: %zu, currently dequeued: %zu, "
"currently cached: %zu\n", mTotalBufferCount, mHandoutTotalBufferCount,
mCachedOutputBufferCount);
- std::string linesStr = std::move(lines.str());
+ std::string linesStr = lines.str();
write(fd, linesStr.c_str(), linesStr.size());
Camera3Stream::dump(fd, args);
diff --git a/services/camera/libcameraservice/utils/TagMonitor.cpp b/services/camera/libcameraservice/utils/TagMonitor.cpp
index 38de93a..5258c0e 100644
--- a/services/camera/libcameraservice/utils/TagMonitor.cpp
+++ b/services/camera/libcameraservice/utils/TagMonitor.cpp
@@ -384,7 +384,7 @@
}
returnStr << "]\n";
}
- return std::move(returnStr.str());
+ return returnStr.str();
}
template<typename T>
diff --git a/services/mediaresourcemanager/ResourceManagerMetrics.cpp b/services/mediaresourcemanager/ResourceManagerMetrics.cpp
index a8a1de1..8b3711c 100644
--- a/services/mediaresourcemanager/ResourceManagerMetrics.cpp
+++ b/services/mediaresourcemanager/ResourceManagerMetrics.cpp
@@ -821,7 +821,7 @@
metricsLog += getAppsPixelCount(mProcessPixelsMap);
metricsLog += getAppsCodecUsageMetrics(mProcessConcurrentCodecsMap);
- return std::move(metricsLog);
+ return metricsLog;
}
} // namespace android
diff --git a/services/mediaresourcemanager/ResourceManagerServiceUtils.cpp b/services/mediaresourcemanager/ResourceManagerServiceUtils.cpp
index 679ab13..49f68e9 100644
--- a/services/mediaresourcemanager/ResourceManagerServiceUtils.cpp
+++ b/services/mediaresourcemanager/ResourceManagerServiceUtils.cpp
@@ -94,7 +94,7 @@
str.append("\n");
}
- return std::move(str);
+ return str;
}
bool ResourceList::operator==(const ResourceList& rhs) const {