From 77c1119ea0b5cb32287088ceeeb7e3b6bd14a85d Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Wed, 25 Jan 2012 14:27:41 -0800 Subject: [PATCH] No need to check a wp<> for 0 before promote() Also remove unnecessary wp<> local variable. Change-Id: I620e67b5d559d28616f8e00609a525cfe19c5ddc --- services/audioflinger/AudioFlinger.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 2d856ada40..f8ad3dfaf3 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -265,13 +265,10 @@ status_t AudioFlinger::dumpClients(int fd, const Vector& args) result.append("Clients:\n"); for (size_t i = 0; i < mClients.size(); ++i) { - wp wClient = mClients.valueAt(i); - if (wClient != 0) { - sp client = wClient.promote(); - if (client != 0) { - snprintf(buffer, SIZE, " pid: %d\n", client->pid()); - result.append(buffer); - } + sp client = mClients.valueAt(i).promote(); + if (client != 0) { + snprintf(buffer, SIZE, " pid: %d\n", client->pid()); + result.append(buffer); } } @@ -1431,13 +1428,10 @@ status_t AudioFlinger::PlaybackThread::dumpTracks(int fd, const Vector result.append(buffer); result.append(" Name Clien Typ Fmt Chn mask Session Buf S M F SRate LeftV RighV Serv User Main buf Aux Buf\n"); for (size_t i = 0; i < mActiveTracks.size(); ++i) { - wp wTrack = mActiveTracks[i]; - if (wTrack != 0) { - sp track = wTrack.promote(); - if (track != 0) { - track->dump(buffer, SIZE); - result.append(buffer); - } + sp track = mActiveTracks[i].promote(); + if (track != 0) { + track->dump(buffer, SIZE); + result.append(buffer); } } write(fd, result.string(), result.size()); -- 2.11.0