PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2 of the License,
+ by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
return n;
}
-void pa_namereg_free(pa_core *c) {
- pa_assert(c);
-
- if (!c->namereg)
- return;
-
- pa_assert(pa_hashmap_size(c->namereg) == 0);
- pa_hashmap_free(c->namereg, NULL, NULL);
-}
-
const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t type, void *data, pa_bool_t fail) {
struct namereg_entry *e;
char *n = NULL;
return NULL;
}
- if (!c->namereg)
- c->namereg = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
-
if ((e = pa_hashmap_get(c->namereg, name)) && fail) {
pa_xfree(n);
return NULL;
}
- if (*name == '@' || !name || !pa_namereg_is_valid_name(name))
+ if (!name)
+ return NULL;
+
+ if ((type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE || type == PA_NAMEREG_CARD) &&
+ !pa_namereg_is_valid_name(name))
return NULL;
- if (c->namereg && (e = pa_hashmap_get(c->namereg, name)))
+ if ((e = pa_hashmap_get(c->namereg, name)))
if (e->type == type)
return e->data;