mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
some updates for pa_hashmap
add property infrastructure add module module-x11-publish allow ldpreloading of all modules abstract x11wrap from module-x11-bell git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@268 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
4e5c44de30
commit
899788b4c5
36 changed files with 827 additions and 90 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include "hashmap.h"
|
||||
#include "idxset.h"
|
||||
#include "xmalloc.h"
|
||||
#include "log.h"
|
||||
|
||||
struct hashmap_entry {
|
||||
struct hashmap_entry *next, *previous, *bucket_next, *bucket_previous;
|
||||
|
|
@ -147,25 +148,27 @@ void* pa_hashmap_get(struct pa_hashmap *h, const void *key) {
|
|||
return e->value;
|
||||
}
|
||||
|
||||
int pa_hashmap_remove(struct pa_hashmap *h, const void *key) {
|
||||
void* pa_hashmap_remove(struct pa_hashmap *h, const void *key) {
|
||||
struct hashmap_entry *e;
|
||||
unsigned hash;
|
||||
void *data;
|
||||
assert(h && key);
|
||||
|
||||
hash = h->hash_func(key) % h->size;
|
||||
|
||||
if (!(e = get(h, hash, key)))
|
||||
return 1;
|
||||
return NULL;
|
||||
|
||||
data = e->value;
|
||||
remove(h, e);
|
||||
return 0;
|
||||
return data;
|
||||
}
|
||||
|
||||
unsigned pa_hashmap_ncontents(struct pa_hashmap *h) {
|
||||
return h->n_entries;
|
||||
}
|
||||
|
||||
void *pa_hashmap_iterate(struct pa_hashmap *h, void **state) {
|
||||
void *pa_hashmap_iterate(struct pa_hashmap *h, void **state, const void **key) {
|
||||
assert(h && state);
|
||||
|
||||
if (!*state) {
|
||||
|
|
@ -173,8 +176,14 @@ void *pa_hashmap_iterate(struct pa_hashmap *h, void **state) {
|
|||
} else
|
||||
*state = ((struct hashmap_entry*) *state)->next;
|
||||
|
||||
if (!*state)
|
||||
if (!*state) {
|
||||
if (key)
|
||||
*key = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (key)
|
||||
*key = ((struct hashmap_entry*) *state)->key;
|
||||
|
||||
return ((struct hashmap_entry*) *state)->value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue