Merge branch 'nirbheek/gmodule-suffix-deprecation' into 'main'

Improve g_module_open(), deprecate G_MODULE_SUFFIX

Closes #520 e #1413

See merge request GNOME/glib!2950
This commit is contained in:
Marco Trevisan
2022-10-27 16:27:42 +00:00
14 changed files with 169 additions and 71 deletions

View File

@@ -23,10 +23,16 @@
#include <gio/gio.h>
#include <glibconfig.h>
#ifdef _MSC_VER
# define MODULE_FILENAME_PREFIX ""
#ifdef G_OS_WIN32
#ifdef _MSC_VER
#define MODULE_FILENAME(x) "" x ".dll"
#else
#define MODULE_FILENAME(x) "lib" x ".dll"
#endif
#elif defined(G_OS_DARWIN)
#define MODULE_FILENAME(x) "lib" x ".dylib"
#else
# define MODULE_FILENAME_PREFIX "lib"
#define MODULE_FILENAME(x) "lib" x ".so"
#endif
static void
@@ -131,7 +137,7 @@ test_module_scan_all_with_scope (void)
ep = g_io_extension_point_register ("test-extension-point");
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
g_io_module_scope_block (scope, MODULE_FILENAME_PREFIX "testmoduleb." G_MODULE_SUFFIX);
g_io_module_scope_block (scope, MODULE_FILENAME ("testmoduleb"));
g_io_modules_scan_all_in_directory_with_scope (g_test_get_filename (G_TEST_BUILT, "modules", NULL), scope);
list = g_io_extension_point_get_extensions (ep);
g_assert_cmpint (g_list_length (list), ==, 1);

View File

@@ -66,10 +66,7 @@ gio_tests = {
'file-thumbnail' : {},
'fileattributematcher' : {},
'filter-streams' : {},
'giomodule' : {
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'should_fail' : host_system == 'darwin',
},
'giomodule' : {},
'gsubprocess' : {},
'g-file' : {},
'g-file-info' : {},
@@ -859,8 +856,6 @@ if meson.can_run_host_binaries()
gio_tests += {
'resources' : {
'extra_sources' : resources_extra_sources,
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
'should_fail' : host_system == 'darwin',
},
}
endif

View File

@@ -805,7 +805,11 @@ test_uri_query_info (void)
g_assert_nonnull (content_type);
mime_type = g_content_type_get_mime_type (content_type);
g_assert_nonnull (mime_type);
#ifdef G_OS_DARWIN
g_assert_cmpstr (mime_type, ==, "text/*");
#else
g_assert_cmpstr (mime_type, ==, "text/plain");
#endif
g_free (mime_type);
g_object_unref (info);