1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-16 06:15:24 +00:00

Update: As of now we have no weak refs, so not store mount identifier in a tree

This commit is contained in:
Philipp Schafft 2020-10-24 07:56:12 +00:00
parent cf6fad00bd
commit 6c1233402d

View File

@ -26,8 +26,6 @@ struct mount_identifier_tag {
REFOBJECT_DEFINE_TYPE(mount_identifier_t);
static avl_tree *mount_identifier_list;
static int mount_identifier_compare(void *compare_arg, void *a, void *b)
{
const char *id_a, *id_b;
@ -44,19 +42,16 @@ static int mount_identifier_compare(void *compare_arg, void *a, void *b)
void navigation_initialize(void)
{
mount_identifier_list = avl_tree_new(mount_identifier_compare, NULL);
}
void navigation_shutdown(void)
{
avl_tree_free(mount_identifier_list, (avl_free_key_fun_type)refobject_unref);
}
mount_identifier_t * mount_identifier_new(const char *mount)
{
mount_identifier_t *n;
void *result;
if (!mount)
return NULL;
@ -65,16 +60,5 @@ mount_identifier_t * mount_identifier_new(const char *mount)
if (!n)
return NULL;
avl_tree_wlock(mount_identifier_list);
if (avl_get_by_key(mount_identifier_list, n, &result) == 0) {
refobject_unref(n);
n = result;
refobject_ref(n);
} else {
refobject_ref(n);
avl_insert(mount_identifier_list, n);
}
avl_tree_unlock(mount_identifier_list);
return n;
}