Commit 8a46b25c authored by Lubomir Rintel's avatar Lubomir Rintel 🥕

all: require glib 2.40

RHEL 7.1 and Ubuntu 14.04 LTS both have this.

https://bugzilla.gnome.org/show_bug.cgi?id=792323
parent 1443bf77
...@@ -626,8 +626,6 @@ main (int argc, char *argv[]) ...@@ -626,8 +626,6 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);
#endif #endif
nm_g_type_init ();
/* Save terminal settings */ /* Save terminal settings */
tcgetattr (STDIN_FILENO, &termios_orig); tcgetattr (STDIN_FILENO, &termios_orig);
......
...@@ -86,7 +86,7 @@ test_client_meta_check (void) ...@@ -86,7 +86,7 @@ test_client_meta_check (void)
g_assert (pi->setting_info == info); g_assert (pi->setting_info == info);
g_assert (pi->property_name); g_assert (pi->property_name);
g_assert (nm_g_hash_table_add (property_names, (gpointer) pi->property_name)); g_assert (g_hash_table_add (property_names, (gpointer) pi->property_name));
g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, FALSE)); g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, FALSE));
g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, TRUE)); g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, TRUE));
...@@ -107,7 +107,7 @@ test_client_meta_check (void) ...@@ -107,7 +107,7 @@ test_client_meta_check (void)
for (i = 0; info->valid_parts[i]; i++) { for (i = 0; info->valid_parts[i]; i++) {
g_assert (info->valid_parts[i]->setting_info); g_assert (info->valid_parts[i]->setting_info);
g_assert (nm_g_hash_table_add (dup, (gpointer) info->valid_parts[i]->setting_info)); g_assert (g_hash_table_add (dup, (gpointer) info->valid_parts[i]->setting_info));
if (i == 0) { if (i == 0) {
g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION]); g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION]);
......
...@@ -244,8 +244,6 @@ main (int argc, char *argv[]) ...@@ -244,8 +244,6 @@ main (int argc, char *argv[])
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);
nm_g_type_init ();
data.start_timestamp_ms = _now_ms (); data.start_timestamp_ms = _now_ms ();
opt_ctx = g_option_context_new (NULL); opt_ctx = g_option_context_new (NULL);
......
...@@ -359,21 +359,11 @@ nmt_newt_edit_string (const char *data) ...@@ -359,21 +359,11 @@ nmt_newt_edit_string (const char *data)
goto done; goto done;
} }
#if GLIB_CHECK_VERSION (2, 34, 0)
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (!g_spawn_check_exit_status (status, &error)) { if (!g_spawn_check_exit_status (status, &error)) {
nmt_newt_message_dialog (_("Editor failed: %s"), error->message); nmt_newt_message_dialog (_("Editor failed: %s"), error->message);
g_error_free (error); g_error_free (error);
goto done; goto done;
} }
G_GNUC_END_IGNORE_DEPRECATIONS
#else
if (WIFEXITED (status)) {
if (WEXITSTATUS (status) != 0)
nmt_newt_message_dialog (_("Editor failed with status %d"), WEXITSTATUS (status));
} else if (WIFSIGNALED (status))
nmt_newt_message_dialog (_("Editor failed with signal %d"), WTERMSIG (status));
#endif
if (!g_file_get_contents (filename, &new_data, NULL, &error)) { if (!g_file_get_contents (filename, &new_data, NULL, &error)) {
nmt_newt_message_dialog (_("Could not re-read file: %s"), error->message); nmt_newt_message_dialog (_("Could not re-read file: %s"), error->message);
......
...@@ -234,14 +234,14 @@ AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen") ...@@ -234,14 +234,14 @@ AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0], PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0],
[AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/tap-driver.sh') [AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/tap-driver.sh')
AC_SUBST(AM_TESTS_FD_REDIRECT, '--tap')], AC_SUBST(AM_TESTS_FD_REDIRECT, '--tap')],
[PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.32 gmodule-2.0) [PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.40 gmodule-2.0)
AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/test-driver')]) AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/test-driver')])
dnl GLIB_VERSION_MIN_REQUIRED should match the version above. dnl GLIB_VERSION_MIN_REQUIRED should match the version above.
dnl GLIB_VERSION_MAX_ALLOWED should be set to the same version; dnl GLIB_VERSION_MAX_ALLOWED should be set to the same version;
dnl nm-glib.h will cause it to be overridden for the functions dnl nm-glib.h will cause it to be overridden for the functions
dnl we have compat versions of. dnl we have compat versions of.
GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32" GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40"
AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS) AC_SUBST(GLIB_LIBS)
......
...@@ -916,8 +916,6 @@ main (int argc, char **argv) ...@@ -916,8 +916,6 @@ main (int argc, char **argv)
g_option_context_free (opt_ctx); g_option_context_free (opt_ctx);
nm_g_type_init ();
g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM)); g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM));
g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT)); g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT));
......
...@@ -15,9 +15,6 @@ DOC_SOURCE_DIR=$(top_srcdir)/libnm-glib ...@@ -15,9 +15,6 @@ DOC_SOURCE_DIR=$(top_srcdir)/libnm-glib
# Extra options to supply to gtkdoc-scan. # Extra options to supply to gtkdoc-scan.
SCAN_OPTIONS= SCAN_OPTIONS=
# Extra options to supply to gtkdoc-scangobj.
SCANGOBJ_OPTIONS=--type-init-func 'g_type_init();'
# Extra options to supply to gtkdoc-mkdb. # Extra options to supply to gtkdoc-mkdb.
MKDB_OPTIONS=--sgml-mode --output-format=xml MKDB_OPTIONS=--sgml-mode --output-format=xml
......
...@@ -17,9 +17,6 @@ DOC_SOURCE_DIR= \ ...@@ -17,9 +17,6 @@ DOC_SOURCE_DIR= \
# Extra options to supply to gtkdoc-scan. # Extra options to supply to gtkdoc-scan.
SCAN_OPTIONS=--rebuild-types --rebuild-sections SCAN_OPTIONS=--rebuild-types --rebuild-sections
# Extra options to supply to gtkdoc-scangobj.
SCANGOBJ_OPTIONS=--type-init-func 'g_type_init();'
# Extra options to supply to gtkdoc-mkdb. # Extra options to supply to gtkdoc-mkdb.
MKDB_OPTIONS=--sgml-mode --output-format=xml MKDB_OPTIONS=--sgml-mode --output-format=xml
......
...@@ -19,9 +19,6 @@ DOC_SOURCE_DIR= \ ...@@ -19,9 +19,6 @@ DOC_SOURCE_DIR= \
# Extra options to supply to gtkdoc-scan. # Extra options to supply to gtkdoc-scan.
SCAN_OPTIONS=--rebuild-types --rebuild-sections SCAN_OPTIONS=--rebuild-types --rebuild-sections
# Extra options to supply to gtkdoc-scangobj.
SCANGOBJ_OPTIONS=--type-init-func 'g_type_init();'
# Extra options to supply to gtkdoc-mkdb. # Extra options to supply to gtkdoc-mkdb.
MKDB_OPTIONS=--sgml-mode --output-format=xml MKDB_OPTIONS=--sgml-mode --output-format=xml
......
...@@ -124,11 +124,6 @@ main (int argc, char *argv[]) ...@@ -124,11 +124,6 @@ main (int argc, char *argv[])
GDBusProxy *proxy; GDBusProxy *proxy;
GError *error = NULL; GError *error = NULL;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
g_type_init ();
#endif
/* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */ /* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */
proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE, G_DBUS_PROXY_FLAGS_NONE,
......
...@@ -105,11 +105,6 @@ main (int argc, char *argv[]) ...@@ -105,11 +105,6 @@ main (int argc, char *argv[])
GMainLoop *loop; GMainLoop *loop;
GError *error = NULL; GError *error = NULL;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
g_type_init ();
#endif
loop = g_main_loop_new (NULL, FALSE); loop = g_main_loop_new (NULL, FALSE);
/* Connect to NetworkManager */ /* Connect to NetworkManager */
......
...@@ -251,11 +251,6 @@ main (int argc, char *argv[]) ...@@ -251,11 +251,6 @@ main (int argc, char *argv[])
{ {
GDBusProxy *props_proxy; GDBusProxy *props_proxy;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
g_type_init ();
#endif
/* Create a D-Bus proxy to get the object properties from the NM Manager /* Create a D-Bus proxy to get the object properties from the NM Manager
* object. NM_DBUS_* defines are from nm-dbus-interface.h. * object. NM_DBUS_* defines are from nm-dbus-interface.h.
*/ */
......
...@@ -202,11 +202,6 @@ main (int argc, char *argv[]) ...@@ -202,11 +202,6 @@ main (int argc, char *argv[])
int i; int i;
GError *error = NULL; GError *error = NULL;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
g_type_init ();
#endif
/* Get NMClient object */ /* Get NMClient object */
client = nm_client_new (NULL, &error); client = nm_client_new (NULL, &error);
if (!client) { if (!client) {
......
...@@ -65,11 +65,6 @@ main (int argc, char *argv[]) ...@@ -65,11 +65,6 @@ main (int argc, char *argv[])
{ {
GDBusProxy *proxy; GDBusProxy *proxy;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
g_type_init ();
#endif
/* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */ /* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */
proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE, G_DBUS_PROXY_FLAGS_NONE,
......
...@@ -69,11 +69,6 @@ main (int argc, char *argv[]) ...@@ -69,11 +69,6 @@ main (int argc, char *argv[])
const GPtrArray *connections; const GPtrArray *connections;
int i; int i;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
g_type_init ();
#endif
if (!(client = nm_client_new (NULL, &error))) { if (!(client = nm_client_new (NULL, &error))) {
g_message ("Error: Could not connect to NetworkManager: %s.", error->message); g_message ("Error: Could not connect to NetworkManager: %s.", error->message);
g_error_free (error); g_error_free (error);
......
...@@ -56,11 +56,6 @@ main (int argc, char *argv[]) ...@@ -56,11 +56,6 @@ main (int argc, char *argv[])
GMainLoop *loop; GMainLoop *loop;
GBusNameWatcherFlags flags; GBusNameWatcherFlags flags;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
g_type_init ();
#endif
g_print ("Monitor 'org.freedesktop.NetworkManager' D-Bus name\n"); g_print ("Monitor 'org.freedesktop.NetworkManager' D-Bus name\n");
g_print ("===================================================\n"); g_print ("===================================================\n");
......
...@@ -90,11 +90,6 @@ main (int argc, char *argv[]) ...@@ -90,11 +90,6 @@ main (int argc, char *argv[])
GDBusProxyFlags flags; GDBusProxyFlags flags;
GDBusProxy *proxy; GDBusProxy *proxy;
#if !GLIB_CHECK_VERSION (2, 35, 0)
/* Initialize GType system */
g_type_init ();
#endif
/* Monitor 'StateChanged' signal on 'org.freedesktop.NetworkManager' interface */ /* Monitor 'StateChanged' signal on 'org.freedesktop.NetworkManager' interface */
g_print ("Monitor NetworkManager's state\n"); g_print ("Monitor NetworkManager's state\n");
g_print ("==============================\n"); g_print ("==============================\n");
......
...@@ -89,7 +89,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting, ...@@ -89,7 +89,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting,
/* Ensure the setting's GType is registered at library load time */ /* Ensure the setting's GType is registered at library load time */
#define NM_SETTING_REGISTER_TYPE(x) \ #define NM_SETTING_REGISTER_TYPE(x) \
static void __attribute__((constructor)) register_setting (void) \ static void __attribute__((constructor)) register_setting (void) \
{ nm_g_type_init (); g_type_ensure (x); } { g_type_ensure (x); }
GVariant *_nm_setting_get_deprecated_virtual_interface_name (NMSetting *setting, GVariant *_nm_setting_get_deprecated_virtual_interface_name (NMSetting *setting,
NMConnection *connection, NMConnection *connection,
......
...@@ -94,7 +94,6 @@ static void ...@@ -94,7 +94,6 @@ static void
_ensure_registered (void) _ensure_registered (void)
{ {
if (G_UNLIKELY (registered_settings == NULL)) { if (G_UNLIKELY (registered_settings == NULL)) {
nm_g_type_init ();
registered_settings = g_hash_table_new (nm_str_hash, g_str_equal); registered_settings = g_hash_table_new (nm_str_hash, g_str_equal);
registered_settings_by_type = g_hash_table_new (_nm_gtype_hash, _nm_gtype_equal); registered_settings_by_type = g_hash_table_new (_nm_gtype_hash, _nm_gtype_equal);
} }
...@@ -816,7 +815,7 @@ _nm_setting_new_from_dbus (GType setting_type, ...@@ -816,7 +815,7 @@ _nm_setting_new_from_dbus (GType setting_type,
g_variant_unref (entry_key); g_variant_unref (entry_key);
g_variant_unref (entry); g_variant_unref (entry);
if (!nm_g_hash_table_add (keys, key)) { if (!g_hash_table_add (keys, key)) {
g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_SETTING, g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_SETTING,
_("duplicate property")); _("duplicate property"));
g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), key); g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), key);
......
...@@ -253,8 +253,6 @@ _nm_utils_init (void) ...@@ -253,8 +253,6 @@ _nm_utils_init (void)
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
nm_g_type_init ();
_nm_dbus_errors_init (); _nm_dbus_errors_init ();
} }
......
...@@ -6093,66 +6093,6 @@ again: ...@@ -6093,66 +6093,6 @@ again:
/*****************************************************************************/ /*****************************************************************************/
static void
test_g_ptr_array_insert (void)
{
/* this test only makes sense on a recent glib, where we compare our compat
* with the original implementation. */
#if GLIB_CHECK_VERSION(2, 40, 0)
gs_unref_ptrarray GPtrArray *arr1 = g_ptr_array_new ();
gs_unref_ptrarray GPtrArray *arr2 = g_ptr_array_new ();
GRand *rand = nmtst_get_rand ();
guint i;
for (i = 0; i < 560; i++) {
gint32 idx = g_rand_int_range (rand, -1, arr1->len + 1);
g_ptr_array_insert (arr1, idx, GINT_TO_POINTER (i));
_nm_g_ptr_array_insert (arr2, idx, GINT_TO_POINTER (i));
g_assert_cmpint (arr1->len, ==, arr2->len);
g_assert (memcmp (arr1->pdata, arr2->pdata, arr1->len * sizeof (gpointer)) == 0);
}
#endif
}
/*****************************************************************************/
static void
test_g_hash_table_get_keys_as_array (void)
{
GHashTable *table = g_hash_table_new (nm_str_hash, g_str_equal);
guint length = 0;
char **keys;
g_hash_table_insert (table, "one", "1");
g_hash_table_insert (table, "two", "2");
g_hash_table_insert (table, "three", "3");
keys = (char **) _nm_g_hash_table_get_keys_as_array (table, &length);
g_assert (keys);
g_assert_cmpuint (length, ==, 3);
g_assert ( !strcmp (keys[0], "one")
|| !strcmp (keys[1], "one")
|| !strcmp (keys[2], "one"));
g_assert ( !strcmp (keys[0], "two")
|| !strcmp (keys[1], "two")
|| !strcmp (keys[2], "two"));
g_assert ( !strcmp (keys[0], "three")
|| !strcmp (keys[1], "three")
|| !strcmp (keys[2], "three"));
g_assert (!keys[3]);
g_free (keys);
g_hash_table_unref (table);
}
/*****************************************************************************/
static int static int
_test_find_binary_search_cmp (gconstpointer a, gconstpointer b, gpointer dummy) _test_find_binary_search_cmp (gconstpointer a, gconstpointer b, gpointer dummy)
{ {
...@@ -7074,8 +7014,6 @@ int main (int argc, char **argv) ...@@ -7074,8 +7014,6 @@ int main (int argc, char **argv)
g_test_add_func ("/core/general/_nm_utils_ascii_str_to_int64", test_nm_utils_ascii_str_to_int64); g_test_add_func ("/core/general/_nm_utils_ascii_str_to_int64", test_nm_utils_ascii_str_to_int64);
g_test_add_func ("/core/general/nm_utils_is_power_of_two", test_nm_utils_is_power_of_two); g_test_add_func ("/core/general/nm_utils_is_power_of_two", test_nm_utils_is_power_of_two);
g_test_add_func ("/core/general/_glib_compat_g_ptr_array_insert", test_g_ptr_array_insert);
g_test_add_func ("/core/general/_glib_compat_g_hash_table_get_keys_as_array", test_g_hash_table_get_keys_as_array);
g_test_add_func ("/core/general/_nm_utils_ptrarray_find_binary_search", test_nm_utils_ptrarray_find_binary_search); g_test_add_func ("/core/general/_nm_utils_ptrarray_find_binary_search", test_nm_utils_ptrarray_find_binary_search);
g_test_add_func ("/core/general/_nm_utils_ptrarray_find_binary_search_with_duplicates", test_nm_utils_ptrarray_find_binary_search_with_duplicates); g_test_add_func ("/core/general/_nm_utils_ptrarray_find_binary_search_with_duplicates", test_nm_utils_ptrarray_find_binary_search_with_duplicates);
g_test_add_func ("/core/general/_nm_utils_strstrdictkey", test_nm_utils_strstrdictkey); g_test_add_func ("/core/general/_nm_utils_strstrdictkey", test_nm_utils_strstrdictkey);
......
...@@ -400,8 +400,6 @@ main (int argc, char *argv[]) ...@@ -400,8 +400,6 @@ main (int argc, char *argv[])
{ {
NMClient *client; NMClient *client;
nm_g_type_init ();
client = nm_client_new (); client = nm_client_new ();
if (!client) { if (!client) {
exit (1); exit (1);
......
...@@ -495,8 +495,6 @@ libnm_glib_init (void) ...@@ -495,8 +495,6 @@ libnm_glib_init (void)
{ {
libnm_glib_ctx *ctx = NULL; libnm_glib_ctx *ctx = NULL;
nm_g_type_init ();
if (!g_thread_supported ()) if (!g_thread_supported ())
g_thread_init (NULL); g_thread_init (NULL);
dbus_g_thread_init (); dbus_g_thread_init ();
......
...@@ -956,8 +956,6 @@ main (int argc, char *argv[]) ...@@ -956,8 +956,6 @@ main (int argc, char *argv[])
{ {
DBusGConnection *bus; DBusGConnection *bus;
nm_g_type_init ();
bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL); bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
compare_ints (); compare_ints ();
......
...@@ -105,7 +105,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting, ...@@ -105,7 +105,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting,
/* Ensure the setting's GType is registered at library load time */ /* Ensure the setting's GType is registered at library load time */
#define NM_SETTING_REGISTER_TYPE(x) \ #define NM_SETTING_REGISTER_TYPE(x) \
static void __attribute__((constructor)) register_setting (void) \ static void __attribute__((constructor)) register_setting (void) \
{ nm_g_type_init (); g_type_ensure (x); } { g_type_ensure (x); }
NMSetting *nm_setting_find_in_list (GSList *settings_list, const char *setting_name); NMSetting *nm_setting_find_in_list (GSList *settings_list, const char *setting_name);
......
...@@ -102,7 +102,6 @@ static void ...@@ -102,7 +102,6 @@ static void
_ensure_registered (void) _ensure_registered (void)
{ {
if (G_UNLIKELY (registered_settings == NULL)) { if (G_UNLIKELY (registered_settings == NULL)) {
nm_g_type_init ();
_nm_value_transforms_register (); _nm_value_transforms_register ();
registered_settings = g_hash_table_new (g_str_hash, g_str_equal); registered_settings = g_hash_table_new (g_str_hash, g_str_equal);
registered_settings_by_type = g_hash_table_new (_nm_gtype_hash, _nm_gtype_equal); registered_settings_by_type = g_hash_table_new (_nm_gtype_hash, _nm_gtype_equal);
......
...@@ -386,10 +386,10 @@ _add (NMDedupMultiIndex *self, ...@@ -386,10 +386,10 @@ _add (NMDedupMultiIndex *self,
head_entry->len++; head_entry->len++;
if ( add_head_entry if ( add_head_entry
&& !nm_g_hash_table_add (self->idx_entries, head_entry)) && !g_hash_table_add (self->idx_entries, head_entry))
nm_assert_not_reached (); nm_assert_not_reached ();
if (!nm_g_hash_table_add (self->idx_entries, entry)) if (!g_hash_table_add (self->idx_entries, entry))
nm_assert_not_reached (); nm_assert_not_reached ();
NM_SET_OUT (out_entry, entry); NM_SET_OUT (out_entry, entry);
...@@ -870,7 +870,7 @@ nm_dedup_multi_index_obj_intern (NMDedupMultiIndex *self, ...@@ -870,7 +870,7 @@ nm_dedup_multi_index_obj_intern (NMDedupMultiIndex *self,
nm_assert (obj_new); nm_assert (obj_new);
nm_assert (!obj_new->_multi_idx); nm_assert (!obj_new->_multi_idx);
if (!nm_g_hash_table_add (self->idx_objs, (gpointer) obj_new)) if (!g_hash_table_add (self->idx_objs, (gpointer) obj_new))
nm_assert_not_reached (); nm_assert_not_reached ();
((NMDedupMultiObj *) obj_new)->_multi_idx = self; ((NMDedupMultiObj *) obj_new)->_multi_idx = self;
......
This diff is collapsed.
...@@ -332,8 +332,6 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_ ...@@ -332,8 +332,6 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
__nmtst_internal.assert_logging = !!assert_logging; __nmtst_internal.assert_logging = !!assert_logging;
nm_g_type_init ();
is_debug = g_test_verbose (); is_debug = g_test_verbose ();
nmtst_debug = g_getenv ("NMTST_DEBUG"); nmtst_debug = g_getenv ("NMTST_DEBUG");
...@@ -540,13 +538,10 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_ ...@@ -540,13 +538,10 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
*out_set_logging = TRUE; *out_set_logging = TRUE;
#endif #endif
g_assert (success); g_assert (success);
#if GLIB_CHECK_VERSION(2,34,0)
if (__nmtst_internal.no_expect_message) if (__nmtst_internal.no_expect_message)
g_log_set_always_fatal (G_LOG_FATAL_MASK); g_log_set_always_fatal (G_LOG_FATAL_MASK);
#else
/* g_test_expect_message() is a NOP, so allow any messages */ /* g_test_expect_message() is a NOP, so allow any messages */
g_log_set_always_fatal (G_LOG_FATAL_MASK); g_log_set_always_fatal (G_LOG_FATAL_MASK);
#endif
} else if (__nmtst_internal.no_expect_message) { } else if (__nmtst_internal.no_expect_message) {
/* We have a test that would be assert_logging, but the user specified no_expect_message. /* We have a test that would be assert_logging, but the user specified no_expect_message.
* This transforms g_test_expect_message() into a NOP, but we also have to relax * This transforms g_test_expect_message() into a NOP, but we also have to relax
...@@ -566,14 +561,9 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_ ...@@ -566,14 +561,9 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
} }
#endif #endif
} else { } else {
#if GLIB_CHECK_VERSION(2,34,0)
/* We were called not to set logging levels. This means, that the user /* We were called not to set logging levels. This means, that the user
* expects to assert against (all) messages. Any uncought message is fatal. */ * expects to assert against (all) messages. Any uncought message is fatal. */
g_log_set_always_fatal (G_LOG_LEVEL_MASK); g_log_set_always_fatal (G_LOG_LEVEL_MASK);
#else
/* g_test_expect_message() is a NOP, so allow any messages */
g_log_set_always_fatal (G_LOG_FATAL_MASK);
#endif
} }
if ((!__nmtst_internal.assert_logging || (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message)) && if ((!__nmtst_internal.assert_logging || (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message)) &&
...@@ -640,7 +630,6 @@ nmtst_test_quick (void) ...@@ -640,7 +630,6 @@ nmtst_test_quick (void)
return __nmtst_internal.test_quick; return __nmtst_internal.test_quick;
} }
#if GLIB_CHECK_VERSION(2,34,0)
#undef g_test_expect_message #undef g_test_expect_message
#define g_test_expect_message(...) \ #define g_test_expect_message(...) \
G_STMT_START { \ G_STMT_START { \
...@@ -664,11 +653,8 @@ nmtst_test_quick (void) ...@@ -664,11 +653,8 @@ nmtst_test_quick (void)
if (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message) \ if (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message) \
g_debug ("nmtst: assert-logging: g_test_assert_expected_messages(%s, %s:%d, %s)", _domain?:"", _file?:"", _line, _func?:""); \ g_debug ("nmtst: assert-logging: g_test_assert_expected_messages(%s, %s:%d, %s)", _domain?:"", _file?:"", _line, _func?:""); \
\ \
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
g_test_assert_expected_messages_internal (_domain, _file, _line, _func); \ g_test_assert_expected_messages_internal (_domain, _file, _line, _func); \
G_GNUC_END_IGNORE_DEPRECATIONS \
} G_STMT_END } G_STMT_END
#endif
#define NMTST_EXPECT(domain, level, msg) g_test_expect_message (domain, level, msg) #define NMTST_EXPECT(domain, level, msg) g_test_expect_message (domain, level, msg)
...@@ -1739,7 +1725,7 @@ _nmtst_assert_connection_has_settings (NMConnection *connection, gboolean has_at ...@@ -1739,7 +1725,7 @@ _nmtst_assert_connection_has_settings (NMConnection *connection, gboolean has_at
va_start (ap, has_at_most); va_start (ap, has_at_most);
while ((name = va_arg (ap, const char *))) { while ((name = va_arg (ap, const char *))) {
if (!nm_g_hash_table_add (names, (gpointer) name)) if (!g_hash_table_add (names, (gpointer) name))
g_assert_not_reached (); g_assert_not_reached ();
g_ptr_array_add (names_arr, (gpointer) name); g_ptr_array_add (names_arr, (gpointer) name);
} }
......
...@@ -9331,7 +9331,7 @@ _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name, ...@@ -9331,7 +9331,7 @@ _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name,
gs_unref_hashtable GHashTable *check_dups = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL); gs_unref_hashtable GHashTable *check_dups = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL);
for (i = 0; argv[i]; i++) { for (i = 0; argv[i]; i++) {
if (!nm_g_hash_table_add (check_dups, (char *) argv[i])) if (!g_hash_table_add (check_dups, (char *) argv[i]))
nm_assert (FALSE); nm_assert (FALSE);
} }
nm_assert (g_hash_table_size (check_dups) > 0); nm_assert (g_hash_table_size (check_dups) > 0);
...@@ -12344,7 +12344,7 @@ available_connections_del_all (NMDevice *self) ...@@ -12344,7 +12344,7 @@ available_connections_del_all (NMDevice *self)
static gboolean static gboolean
available_connections_add (NMDevice *self, NMConnection *connection) available_connections_add (NMDevice *self, NMConnection *connection)
{ {
return nm_g_hash_table_add (self->_priv->available_connections, g_object_ref (connection)); return g_hash_table_add (self->_priv->available_connections, g_object_ref (connection));
} }
static gboolean static gboolean
......
...@@ -134,8 +134,6 @@ main (int argc, char *argv[]) ...@@ -134,8 +134,6 @@ main (int argc, char *argv[])
guint try_count = 0; guint try_count = 0;
gint64 time_end; gint64 time_end;
nm_g_type_init ();
/* FIXME: g_dbus_connection_new_for_address_sync() tries to connect to the socket in /* FIXME: g_dbus_connection_new_for_address_sync() tries to connect to the socket in
* non-blocking mode, which can easily fail with EAGAIN, causing the creation of the * non-blocking mode, which can easily fail with EAGAIN, causing the creation of the