From 2b9bb92aa560192d1c3e31492a8f87d3ccb955f5 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Wed, 2 Dec 2020 14:17:54 +0800 Subject: [PATCH] add TK_FUNC_NAME_LEN --- src/tkc/plugin_manager.c | 8 ++++---- src/tkc/types_def.h | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/tkc/plugin_manager.c b/src/tkc/plugin_manager.c index b620fc328..85d32e91a 100644 --- a/src/tkc/plugin_manager.c +++ b/src/tkc/plugin_manager.c @@ -50,7 +50,7 @@ static ret_t plugin_destroy(plugin_t* plugin) { if (plugin->plugin_manager != NULL && plugin->handle != NULL) { char name[MAX_PATH + 1]; - char func[TK_NAME_LEN + 1]; + char func[TK_FUNC_NAME_LEN + 1]; tk_dl_t* handle = plugin->handle; const char* lib_name = plugin->lib_name; plugin_manager_t* plugin_manager = plugin->plugin_manager; @@ -61,7 +61,7 @@ static ret_t plugin_destroy(plugin_t* plugin) { plugin_manager->get_deinit(func, name_from_lib_name(name, lib_name)) == RET_OK) { log_debug("deinit func:%s\n", func); } else { - tk_strncpy(func, TK_PLUGIN_DEINIT, TK_NAME_LEN); + tk_strncpy(func, TK_PLUGIN_DEINIT, TK_FUNC_NAME_LEN); } plugin_deinit_func_t deinit = (plugin_deinit_func_t)tk_dl_sym(handle, func); if (deinit != NULL) { @@ -110,7 +110,7 @@ static plugin_t* plugin_create(const char* path, const char* lib_name, if (plugin != NULL) { char name[MAX_PATH + 1]; - char func[TK_NAME_LEN + 1]; + char func[TK_FUNC_NAME_LEN + 1]; memset(name, 0x00, sizeof(name)); memset(func, 0x00, sizeof(func)); @@ -118,7 +118,7 @@ static plugin_t* plugin_create(const char* path, const char* lib_name, plugin_manager->get_init(func, name_from_lib_name(name, lib_name)) == RET_OK) { log_debug("init func:%s\n", func); } else { - tk_strncpy(func, TK_PLUGIN_INIT, TK_NAME_LEN); + tk_strncpy(func, TK_PLUGIN_INIT, TK_FUNC_NAME_LEN); } plugin_init_func_t init = (plugin_init_func_t)tk_dl_sym(handle, func); if (init != NULL) { diff --git a/src/tkc/types_def.h b/src/tkc/types_def.h index 27a79484e..e346a6b31 100644 --- a/src/tkc/types_def.h +++ b/src/tkc/types_def.h @@ -330,7 +330,10 @@ typedef ret_t (*tk_visit_t)(void* ctx, const void* data); typedef ret_t (*tk_callback_t)(void* ctx); /*TK_NAME_LEN+1 must aligned to 4*/ -enum { TK_NAME_LEN = 31 }; +enum { + TK_NAME_LEN = 31, + TK_FUNC_NAME_LEN = 63 +}; #ifdef WITH_CPPCHECK #define tk_str_eq strcmp