diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2017-10-22 20:30:07 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2017-10-23 20:04:14 +0000 |
commit | 14e687c1dd17e7a39a7cf3293e3397ac36117e49 (patch) | |
tree | 09d7b4482c7b4b8b33b6b15dc7f48c58e26a3785 /wsutil | |
parent | 12d63c428f973b1f7e04ad58d432d778e2035a9a (diff) |
Make plugin support a runtime property
Keep the option to disable at compile-time but use AC_ARG_ENABLE instead.
Change-Id: Ie8c3f5ba0db1eb6d9d4ffd742cd3aa049ead5007
Reviewed-on: https://code.wireshark.org/review/24026
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/plugins.c | 17 | ||||
-rw-r--r-- | wsutil/plugins.h | 1 |
2 files changed, 17 insertions, 1 deletions
diff --git a/wsutil/plugins.c b/wsutil/plugins.c index cde504a24e..9448063372 100644 --- a/wsutil/plugins.c +++ b/wsutil/plugins.c @@ -304,6 +304,9 @@ scan_plugins_build_dir(plugin_load_failure_mode mode) void scan_plugins(plugin_load_failure_mode mode) { + if (!g_module_supported()) + return; /* nothing to do */ + if (plugins_table != NULL) return; /* only scan for plugins once */ @@ -373,6 +376,9 @@ plugins_get_descriptions(plugin_description_callback callback, void *user_data) GPtrArray *descriptions; struct description_callback cb; + if (!plugins_table) + return; + descriptions = g_ptr_array_sized_new(g_hash_table_size(plugins_table)); g_hash_table_foreach(plugins_table, add_plugin_to_descriptions, descriptions); g_ptr_array_sort(descriptions, compare_plugins); @@ -396,10 +402,19 @@ plugins_dump_all(void) plugins_get_descriptions(print_plugin_description, NULL); } +int +plugins_get_count(void) +{ + if (plugins_table) + return g_hash_table_size(plugins_table); + return 0; +} + void plugins_cleanup(void) { - g_hash_table_destroy(plugins_table); + if (plugins_table) + g_hash_table_destroy(plugins_table); g_slist_foreach(plugin_types, free_plugin_type, NULL); g_slist_free(plugin_types); } diff --git a/wsutil/plugins.h b/wsutil/plugins.h index 6f227706b1..ab3eb0c004 100644 --- a/wsutil/plugins.h +++ b/wsutil/plugins.h @@ -45,6 +45,7 @@ typedef void (*plugin_description_callback)(const char *name, const char *versio void *user_data); WS_DLL_PUBLIC void plugins_get_descriptions(plugin_description_callback callback, void *user_data); WS_DLL_PUBLIC void plugins_dump_all(void); +WS_DLL_PUBLIC int plugins_get_count(void); WS_DLL_PUBLIC void plugins_cleanup(void); #ifdef __cplusplus |