From 5969a1df8e323e7d9c355c460a3842a5b996887f Mon Sep 17 00:00:00 2001 From: Vftdan Date: Sun, 18 Aug 2024 14:44:39 +0200 Subject: [PATCH] Expose module registry --- module_registry.c | 11 ++++++++--- module_registry.h | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/module_registry.c b/module_registry.c index 6daa1a9..2378755 100644 --- a/module_registry.c +++ b/module_registry.c @@ -1,7 +1,6 @@ #include "module_registry.h" -#include "hash_table.h" -static TYPED_HASH_TABLE(GraphNodeSpecification*) registry; +static GraphNodeSpecificationRegistry registry; static bool initialized = false; static void @@ -34,7 +33,13 @@ lookup_graph_node_specification(const char * name) return registry.value_array[idx]; } -void +const GraphNodeSpecificationRegistry * +get_graph_node_specification_registy() +{ + ensure_initialized(); + return ®istry; +} + __attribute__((destructor)) void destroy_graph_node_specification_registry() { diff --git a/module_registry.h b/module_registry.h index 4b21062..36fae47 100644 --- a/module_registry.h +++ b/module_registry.h @@ -2,9 +2,13 @@ #define MODULE_REGISTRY_H_ #include "graph.h" +#include "hash_table.h" + +typedef TYPED_HASH_TABLE(GraphNodeSpecification*) GraphNodeSpecificationRegistry; void register_graph_node_specification(GraphNodeSpecification * spec); GraphNodeSpecification * lookup_graph_node_specification(const char * name); void destroy_graph_node_specification_registry(); +const GraphNodeSpecificationRegistry * get_graph_node_specification_registy(); #endif /* end of include guard: MODULE_REGISTRY_H_ */