mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-16 08:56:40 -05:00
hashmap: implement pa_hashmap_last()
This commit is contained in:
parent
a1d84e3935
commit
c6830bd9dc
2 changed files with 12 additions and 0 deletions
|
|
@ -279,6 +279,15 @@ void* pa_hashmap_first(pa_hashmap *h) {
|
||||||
return h->iterate_list_head->value;
|
return h->iterate_list_head->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* pa_hashmap_last(pa_hashmap *h) {
|
||||||
|
pa_assert(h);
|
||||||
|
|
||||||
|
if (!h->iterate_list_tail)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return h->iterate_list_tail->value;
|
||||||
|
}
|
||||||
|
|
||||||
void* pa_hashmap_steal_first(pa_hashmap *h) {
|
void* pa_hashmap_steal_first(pa_hashmap *h) {
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,9 @@ void *pa_hashmap_steal_first(pa_hashmap *h);
|
||||||
/* Return the oldest entry in the hashmap */
|
/* Return the oldest entry in the hashmap */
|
||||||
void* pa_hashmap_first(pa_hashmap *h);
|
void* pa_hashmap_first(pa_hashmap *h);
|
||||||
|
|
||||||
|
/* Return the newest entry in the hashmap */
|
||||||
|
void* pa_hashmap_last(pa_hashmap *h);
|
||||||
|
|
||||||
/* A macro to ease iteration through all entries */
|
/* A macro to ease iteration through all entries */
|
||||||
#define PA_HASHMAP_FOREACH(e, h, state) \
|
#define PA_HASHMAP_FOREACH(e, h, state) \
|
||||||
for ((state) = NULL, (e) = pa_hashmap_iterate((h), &(state), NULL); (e); (e) = pa_hashmap_iterate((h), &(state), NULL))
|
for ((state) = NULL, (e) = pa_hashmap_iterate((h), &(state), NULL); (e); (e) = pa_hashmap_iterate((h), &(state), NULL))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue