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

Skip to content
Commit 1f812f72 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

Fix const sp<>& in parameter list and return value

EffectModule::addHandle and Client::heap() were declared incorrectly.

As a parameter, an sp<> should be & for efficiency, and for input
parameters it should also be const to protect the caller's value.

But as a return value, an sp<> should have neither const or &.  The "e"
in "return e;" might be located on the stack, and if there is "&" then
the caller would see the address of a variable which no longer exists.
Also, an & would make it hard to do "return 0;".
A "const" without & is meaningless in the return type.
(In this particular case, the "e" is a member field, so it was safe.)

Change-Id: I3df5f294214eb15a9d4d596c6d5ef29de97b5c27
parent acabf488
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