@@ -428,7 +428,6 @@ int snd_ctl_elem_id_equal_by_numid(snd_ctl_elem_id_t *l, snd_ctl_elem_id_t *r);
int snd_ctl_elem_id_equal_by_tuple(snd_ctl_elem_id_t *l, snd_ctl_elem_id_t *r);
int snd_ctl_elem_id_compare_by_numid(snd_ctl_elem_id_t *l, snd_ctl_elem_id_t *r);
int snd_ctl_elem_id_compare_by_tuple_arithmetic(snd_ctl_elem_id_t *l, snd_ctl_elem_id_t *r);
-int snd_ctl_elem_id_compare(snd_ctl_elem_id_t *id1, const snd_ctl_elem_id_t *id2);
unsigned int snd_ctl_elem_id_get_numid(const snd_ctl_elem_id_t *obj);
snd_ctl_elem_iface_t snd_ctl_elem_id_get_interface(const snd_ctl_elem_id_t *obj);
unsigned int snd_ctl_elem_id_get_device(const snd_ctl_elem_id_t *obj);
@@ -1936,41 +1936,6 @@ int snd_ctl_elem_id_compare_by_tuple_arithmetic(snd_ctl_elem_id_t *l, snd_ctl_el
return compare_unsigned_integer(l->index, r->index);
}
-/**
- * \brief compare one #snd_ctl_elem_id_t to another
- * \param id1 pointer to first id
- * \param id2 pointer to second id
- * \retval zero when values are identical, other value on a difference (like strcmp)
- *
- * This comparison ignores the numid part. The numid comparison can be easily
- * implemented using snd_ctl_elem_id_get_numid() calls.
- *
- * The identifier fields are compared in this order: interface, device,
- * subdevice, name, index.
- *
- * The return value can be used for sorting like qsort(). It gives persistent
- * results.
- */
-int snd_ctl_elem_id_compare(snd_ctl_elem_id_t *id1, const snd_ctl_elem_id_t *id2)
-{
- int d;
-
- assert(id1 && id2);
- d = id1->iface - id2->iface;
- if (d != 0)
- return d;
- d = id1->device - id2->device;
- if (d != 0)
- return d;
- d = id2->subdevice - id2->subdevice;
- if (d != 0)
- return d;
- d = strcmp((const char *)id1->name, (const char *)id2->name);
- if (d != 0)
- return d;
- return id1->index - id2->index;
-}
-
/**
* \brief Get numeric identifier from a CTL element identifier
* \param obj CTL element identifier
A commit 2cfe6addaef6 ("control: add snd_ctl_elem_id_compare() function") adds 'snd_ctl_elem_id_compare()' API, however the implementation has several bugs. At first, the name is not inappropriate since it implements one of comparison algorithms. The name itself implies the algorithm is single and unique for control element ID. Secondary, it subtracts a pair of values in fields of 'unsigned int' type in storage size of the type. It brings integer overflow. Tertiary, it compares subdevice field in the same structure. Fortunately, the issued API is not public in any release. An alternative API, 'snd_ctl_elem_id_compare_by_name_arithmetic()', is already added with enough tests. This commit drops the issued API. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> --- include/control.h | 1 - src/control/control.c | 35 ----------------------------------- 2 files changed, 36 deletions(-)