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

Commit f7154e8a authored by Ying Hsu's avatar Ying Hsu
Browse files

Floss: Remove extra clone in cb_variant

For a specific type of callback from libbluetooth, the dispatcher's
reference counter is expected to be increased by 1 each time the callback
is executed and then decreased by 1 before leaving the callback function.
As DispatchContainer::get() has cloned the dispatcher object,
the clone() in cb_variant macro is not necessary.

Bug: 237346241
Tag: #floss
Test: run btadapterd on volteer
Change-Id: I5a175a6f1fc47b943cfb6eb868f4ad650e507b70
parent 86d8ad0c
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -127,9 +127,7 @@ pub fn cb_variant(input: TokenStream) -> TokenStream {
        extern "C" fn #ident(#params) {
            #stmts

            unsafe {
                (get_dispatchers().lock().unwrap().get::<#dispatcher>().unwrap().clone().lock().unwrap().dispatch)(#rpath(#args));
            }
            (get_dispatchers().lock().unwrap().get::<#dispatcher>().unwrap().lock().unwrap().dispatch)(#rpath(#args));
        }
    };