Revert "context: hash the globals by id"

This reverts commit 80b2e345d7.
This commit is contained in:
Wim Taymans 2022-01-14 20:01:00 +01:00
parent 0904a35ba8
commit 77ee3aecd2
2 changed files with 2 additions and 13 deletions

View file

@ -199,7 +199,6 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop,
struct pw_properties *pr, *conf; struct pw_properties *pr, *conf;
struct spa_cpu *cpu; struct spa_cpu *cpu;
int res = 0; int res = 0;
struct spa_list *m;
impl = calloc(1, sizeof(struct impl) + user_data_size); impl = calloc(1, sizeof(struct impl) + user_data_size);
if (impl == NULL) { 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->factory_lib, 32);
pw_array_init(&this->objects, 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->core_impl_list);
spa_list_init(&this->protocol_list); spa_list_init(&this->protocol_list);
spa_list_init(&this->core_list); spa_list_init(&this->core_list);
@ -484,6 +480,7 @@ void pw_context_destroy(struct pw_context *context)
free(entry->lib); free(entry->lib);
} }
pw_array_clear(&context->factory_lib); pw_array_clear(&context->factory_lib);
pw_array_clear(&context->objects); pw_array_clear(&context->objects);
spa_hook_list_clean(&context->listener_list); 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) static struct pw_global *find_global(struct pw_context *context, uint32_t id)
{ {
struct pw_global *g; struct pw_global *g;
struct spa_list *l; spa_list_for_each(g, &context->global_list, link) {
l = &context->global_map[id % GLOBAL_HASH_SIZE];
spa_list_for_each(g, l, map_link) {
if (g->id == id) if (g->id == id)
return g; return g;
} }
@ -625,7 +619,6 @@ uint32_t pw_context_add_global(struct pw_context *context, struct pw_global *glo
global->id = context->serial; global->id = context->serial;
context->serial = (context->serial+1) & PW_ID_MASK; 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->sorted_globals, &global->sorted_link);
spa_list_append(&context->global_list, &global->link); spa_list_append(&context->global_list, &global->link);
return global->id; 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->link);
spa_list_remove(&global->sorted_link); spa_list_remove(&global->sorted_link);
spa_list_remove(&global->map_link);
} }
SPA_EXPORT SPA_EXPORT

View file

@ -321,7 +321,6 @@ struct pw_global {
struct spa_list link; /**< link in context list of globals */ 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 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 */ uint32_t id; /**< server id of the object */
struct pw_properties *properties; /**< properties of the global */ 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 */ struct pw_array factory_lib; /**< mapping of factory_name regexp to library */
uint32_t serial; uint32_t serial;
#define GLOBAL_HASH_SIZE 127
struct spa_list global_map[GLOBAL_HASH_SIZE];
struct spa_list sorted_globals; struct spa_list sorted_globals;
struct pw_array objects; /**< objects */ struct pw_array objects; /**< objects */