plugins: Improve build with !HAVE_PLUGINS
Instead of not compiling plugins.c without HAVE_PLUGINS, we should disable plugin support in a way that is functionally the same as if the platform does not support it at runtime. This reduces the number of ifdefs and allows sharing more utility code for plugins.
This commit is contained in:
parent
8db858b667
commit
5f6b5c40f4
|
@ -183,6 +183,7 @@ set(WSUTIL_COMMON_FILES
|
|||
cpu_info.c
|
||||
os_version_info.c
|
||||
please_report_bug.c
|
||||
plugins.c
|
||||
privileges.c
|
||||
regex.c
|
||||
rsa.c
|
||||
|
@ -214,12 +215,6 @@ if(WIN32)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_PLUGINS)
|
||||
list(APPEND WSUTIL_COMMON_FILES
|
||||
plugins.c
|
||||
)
|
||||
endif()
|
||||
|
||||
set(WSUTIL_FILES
|
||||
${WMEM_FILES}
|
||||
${WSUTIL_COMMON_FILES}
|
||||
|
|
|
@ -236,7 +236,7 @@ DIAG_ON_PEDANTIC
|
|||
plugins_t *
|
||||
plugins_init(plugin_type_e type)
|
||||
{
|
||||
if (!g_module_supported())
|
||||
if (!plugins_supported())
|
||||
return NULL; /* nothing to do */
|
||||
|
||||
GHashTable *plugins_module = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, free_plugin);
|
||||
|
@ -342,7 +342,11 @@ plugins_cleanup(plugins_t *plugins)
|
|||
bool
|
||||
plugins_supported(void)
|
||||
{
|
||||
#ifndef HAVE_PLUGINS
|
||||
return false;
|
||||
#else
|
||||
return g_module_supported();
|
||||
#endif
|
||||
}
|
||||
|
||||
plugin_type_e
|
||||
|
|
Loading…
Reference in New Issue