From 77ee3aecd2a7dee8484c4e60580a0f9d5a2548ad Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 14 Jan 2022 20:01:00 +0100 Subject: [PATCH] Revert "context: hash the globals by id" This reverts commit 80b2e345d7da851ac185f686adcc5c998cdf606a. --- src/pipewire/context.c | 12 ++---------- src/pipewire/private.h | 3 --- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 123a7ba54..040e23184 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -199,7 +199,6 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, struct pw_properties *pr, *conf; struct spa_cpu *cpu; int res = 0; - struct spa_list *m; impl = calloc(1, sizeof(struct impl) + user_data_size); if (impl == NULL) { @@ -217,9 +216,6 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, pw_array_init(&this->factory_lib, 32); pw_array_init(&this->objects, 32); - SPA_FOR_EACH_ELEMENT(this->global_map, m) - spa_list_init(m); - spa_list_init(&this->core_impl_list); spa_list_init(&this->protocol_list); spa_list_init(&this->core_list); @@ -484,6 +480,7 @@ void pw_context_destroy(struct pw_context *context) free(entry->lib); } pw_array_clear(&context->factory_lib); + pw_array_clear(&context->objects); spa_hook_list_clean(&context->listener_list); @@ -588,10 +585,7 @@ int pw_context_for_each_global(struct pw_context *context, static struct pw_global *find_global(struct pw_context *context, uint32_t id) { struct pw_global *g; - struct spa_list *l; - - l = &context->global_map[id % GLOBAL_HASH_SIZE]; - spa_list_for_each(g, l, map_link) { + spa_list_for_each(g, &context->global_list, link) { if (g->id == id) return g; } @@ -625,7 +619,6 @@ uint32_t pw_context_add_global(struct pw_context *context, struct pw_global *glo global->id = context->serial; context->serial = (context->serial+1) & PW_ID_MASK; - spa_list_prepend(&context->global_map[global->id % GLOBAL_HASH_SIZE], &global->map_link); spa_list_append(&context->sorted_globals, &global->sorted_link); spa_list_append(&context->global_list, &global->link); return global->id; @@ -635,7 +628,6 @@ void pw_context_remove_global(struct pw_context *context, struct pw_global *glob { spa_list_remove(&global->link); spa_list_remove(&global->sorted_link); - spa_list_remove(&global->map_link); } SPA_EXPORT diff --git a/src/pipewire/private.h b/src/pipewire/private.h index 16d28ac36..6f706e4f6 100644 --- a/src/pipewire/private.h +++ b/src/pipewire/private.h @@ -321,7 +321,6 @@ struct pw_global { struct spa_list link; /**< link in context list of globals */ struct spa_list sorted_link; /**< link in context list of sorted_globals */ - struct spa_list map_link; /**< link in context list of global_map */ uint32_t id; /**< server id of the object */ struct pw_properties *properties; /**< properties of the global */ @@ -453,8 +452,6 @@ struct pw_context { struct pw_array factory_lib; /**< mapping of factory_name regexp to library */ uint32_t serial; -#define GLOBAL_HASH_SIZE 127 - struct spa_list global_map[GLOBAL_HASH_SIZE]; struct spa_list sorted_globals; struct pw_array objects; /**< objects */