Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 264fa4ce authored by Andy Hung's avatar Andy Hung
Browse files

AudioSystem: Modernize return value optimization

Storing sp<> return values in a const ref to temporary
seems like an outdated way to avoid an additional copy,
if that was indeed the original intention to optimize.

Avoid storing the sp<> return value in a const ref to avoid
confusion with returning a reference (which is dangerous
as it allows access without the lock). Instead store the
sp<> return value in a const lvalue to invoke copy elision
which is guaranteed in C++17.

Test: atest CtsMediaAudioTestCases
Bug: 326504627
Change-Id: I3e34f01be0d9b85289ff88e0bc289eec833b5348
parent acd955ac
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment