Because l_queue_find can't distinguish between entry->data equal to zero
and missing entry, has_binding() fails when we bind app key with index
0, via L_UINT_TO_PTR.
Bug has been introduced in commit
1a2a6debd
Change-Id: Ib9b7801c85a95875d9a3d1645f8fe1a35dbd4948
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
static bool has_binding(struct l_queue *bindings, uint16_t idx)
{
- return l_queue_find(bindings, simple_match, L_UINT_TO_PTR(idx)) != NULL;
+ const struct l_queue_entry *entry;
+
+ for (entry = l_queue_get_entries(bindings); entry; entry = entry->next)
+ if (L_PTR_TO_INT(entry->data) == idx)
+ return true;
+
+ return false;
}
static bool find_virt_by_label(const void *a, const void *b)