diff options
| author | yangwei <[email protected]> | 2024-09-19 15:58:39 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-09-19 15:58:39 +0800 |
| commit | 6af61355e38060ec9de79045b09e606aa5acb126 (patch) | |
| tree | 53cc9def6c9de03ceccecd1eea57f76a516ae8e1 /infra/module_manager | |
| parent | f26ed588daa1c296a23fcef931930778f68df50a (diff) | |
✨ feat(module manager): module new add ctx as parameter
Diffstat (limited to 'infra/module_manager')
| -rw-r--r-- | infra/module_manager/module_manager.c | 3 | ||||
| -rw-r--r-- | infra/module_manager/test/gtest_module_manager_main.cpp | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/infra/module_manager/module_manager.c b/infra/module_manager/module_manager.c index 819384e..3e56c35 100644 --- a/infra/module_manager/module_manager.c +++ b/infra/module_manager/module_manager.c @@ -187,10 +187,11 @@ struct stellar_module *stellar_module_manager_get_module(struct stellar_module_m *******************************************/ -struct stellar_module *stellar_module_new(const char *name) +struct stellar_module *stellar_module_new(const char *name, void *ctx) { struct stellar_module *mod = CALLOC(struct stellar_module, 1); memcpy(mod->name, name, MIN(NAME_MAX, strlen(name))); + mod->module_ctx=ctx; return mod; } diff --git a/infra/module_manager/test/gtest_module_manager_main.cpp b/infra/module_manager/test/gtest_module_manager_main.cpp index 625ec1b..467d5b3 100644 --- a/infra/module_manager/test/gtest_module_manager_main.cpp +++ b/infra/module_manager/test/gtest_module_manager_main.cpp @@ -71,7 +71,7 @@ TEST(module_manager_internal, stellar_module_manager_new_with_toml) { TEST(stellar_module, basic_new_and_free) { - struct stellar_module *mod = stellar_module_new("test"); + struct stellar_module *mod = stellar_module_new("test", NULL); EXPECT_TRUE(mod!=NULL); stellar_module_set_name(mod, "test1"); @@ -145,7 +145,7 @@ TEST(stellar_module_manager, register_thread) { extern "C" struct stellar_module *gtest_module_init(struct stellar_module_manager *mod_mgr) { - struct stellar_module *mod = stellar_module_new("gtest"); + struct stellar_module *mod = stellar_module_new("gtest", NULL); EXPECT_STREQ(stellar_module_get_name(mod), "gtest"); stellar_module_set_ctx(mod, (void*)1); |
