surfaceflinger: fix static analyzer complaints
Due to https://bugs.llvm.org/show_bug.cgi?id=34365, the static analyzer
complains about use of copied `sp`s. In this case, the copy is entirely
unnecessary, since we're just going to destroy the copied-from sp
anyway.
Speed things up a bit + appease the analyzer by moving instead.
Bug: 27101951
Test: mma. Static analyzer no longer complains.
Change-Id: Idf45abcc5c9b3694ef710e330e88a7c2fd766929
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 29e7bd6..bcd7afe 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2144,7 +2144,7 @@
sp<const DisplayDevice> hw(mDisplays[dpy]);
if (hw->getLayerStack() == currentlayerStack) {
if (disp == NULL) {
- disp = hw;
+ disp = std::move(hw);
} else {
disp = NULL;
break;