mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
proplist: New function: pa_proplist_equal()
This commit is contained in:
parent
44770c59e9
commit
1457df40ee
3 changed files with 30 additions and 0 deletions
|
|
@ -180,6 +180,7 @@ pa_path_get_filename;
|
||||||
pa_proplist_clear;
|
pa_proplist_clear;
|
||||||
pa_proplist_contains;
|
pa_proplist_contains;
|
||||||
pa_proplist_copy;
|
pa_proplist_copy;
|
||||||
|
pa_proplist_equal;
|
||||||
pa_proplist_free;
|
pa_proplist_free;
|
||||||
pa_proplist_from_string;
|
pa_proplist_from_string;
|
||||||
pa_proplist_get;
|
pa_proplist_get;
|
||||||
|
|
|
||||||
|
|
@ -680,3 +680,29 @@ int pa_proplist_isempty(pa_proplist *p) {
|
||||||
|
|
||||||
return pa_hashmap_isempty(MAKE_HASHMAP(p));
|
return pa_hashmap_isempty(MAKE_HASHMAP(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pa_proplist_equal(pa_proplist *a, pa_proplist *b) {
|
||||||
|
const void *key = NULL;
|
||||||
|
struct property *a_prop = NULL;
|
||||||
|
struct property *b_prop = NULL;
|
||||||
|
void *state = NULL;
|
||||||
|
|
||||||
|
pa_assert(a);
|
||||||
|
pa_assert(b);
|
||||||
|
|
||||||
|
if (pa_proplist_size(a) != pa_proplist_size(b))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
while ((a_prop = pa_hashmap_iterate(MAKE_HASHMAP(a), &state, &key))) {
|
||||||
|
if (!(b_prop = pa_hashmap_get(MAKE_HASHMAP(b), key)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (a_prop->nbytes != b_prop->nbytes)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (memcmp(a_prop->value, b_prop->value, a_prop->nbytes) != 0)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -354,6 +354,9 @@ unsigned pa_proplist_size(pa_proplist *t);
|
||||||
/** Returns 0 when the proplist is empty, positive otherwise \since 0.9.15 */
|
/** Returns 0 when the proplist is empty, positive otherwise \since 0.9.15 */
|
||||||
int pa_proplist_isempty(pa_proplist *t);
|
int pa_proplist_isempty(pa_proplist *t);
|
||||||
|
|
||||||
|
/** Return non-zero when a and b have the same keys and values. */
|
||||||
|
int pa_proplist_equal(pa_proplist *a, pa_proplist *b);
|
||||||
|
|
||||||
PA_C_DECL_END
|
PA_C_DECL_END
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue