all: remove #if GLIB_CHECK_VERSION conditionals around g_type_init()

g_type_init() is now provided by nm-glib-compat.h as nm_g_type_init().
This commit is contained in:
Thomas Haller 2014-07-10 10:41:31 +02:00
parent 3a33852170
commit 904e961464
24 changed files with 34 additions and 56 deletions

View file

@ -652,9 +652,7 @@ main (int argc, char **argv)
g_option_context_free (opt_ctx);
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM));
g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT));

View file

@ -5,6 +5,7 @@ AM_CPPFLAGS = \
-I${top_builddir}/libnm-core \
-I${top_srcdir}/libnm \
-I${top_builddir}/libnm \
-I${top_srcdir}/include \
$(GLIB_CFLAGS) \
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
-DNMLOCALEDIR=\"$(datadir)/locale\"

View file

@ -38,6 +38,7 @@
#include "polkit-agent.h"
#include "nmcli.h"
#include "nm-glib-compat.h"
#include "utils.h"
#include "common.h"
#include "connections.h"
@ -607,10 +608,8 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
#endif
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
/* Save terminal settings */
tcgetattr (STDIN_FILENO, &termios_orig);

View file

@ -41,6 +41,7 @@
#include <glib/gi18n.h>
#include <NetworkManager.h>
#include "nm-glib-compat.h"
#define PROGRESS_STEPS 15
#define WAIT_STARTUP_TAG "wait-startup"
@ -188,9 +189,7 @@ main (int argc, char *argv[])
}
remaining_ms = t_secs * 1000;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
client = nm_client_new (NULL, &error);
if (!client) {

View file

@ -302,9 +302,7 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
__nmtst_internal.assert_logging = !!assert_logging;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
is_debug = g_test_verbose ();

View file

@ -92,7 +92,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting,
/* Ensure the setting's GType is registered at library load time */
#define NM_SETTING_REGISTER_TYPE(x) \
static void __attribute__((constructor)) register_setting (void) \
{ g_type_init (); g_type_ensure (x); }
{ nm_g_type_init (); g_type_ensure (x); }
GVariant *_nm_setting_get_deprecated_virtual_interface_name (NMSetting *setting,
NMConnection *connection,

View file

@ -95,9 +95,7 @@ static void
_ensure_registered (void)
{
if (G_UNLIKELY (registered_settings == NULL)) {
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
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);
}

View file

@ -240,7 +240,7 @@ _nm_utils_init (void)
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
g_type_init ();
nm_g_type_init ();
_nm_dbus_errors_init ();
}

View file

@ -38,6 +38,7 @@
#include "nm-active-connection.h"
#include "nm-vpn-connection.h"
#include "nm-setting-ip4-config.h"
#include "nm-glib-compat.h"
static gboolean
test_wireless_enabled (NMClient *client)
@ -392,9 +393,7 @@ main (int argc, char *argv[])
{
NMClient *client;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
client = nm_client_new ();
if (!client) {

View file

@ -32,6 +32,8 @@
#include "NetworkManager.h"
#include "libnm_glib.h"
#include "nm-glib-compat.h"
#define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist"
@ -495,9 +497,7 @@ libnm_glib_init (void)
{
libnm_glib_ctx *ctx = NULL;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
if (!g_thread_supported ())
g_thread_init (NULL);

View file

@ -953,9 +953,7 @@ main (int argc, char *argv[])
{
DBusGConnection *bus;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);

View file

@ -101,7 +101,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting,
/* Ensure the setting's GType is registered at library load time */
#define NM_SETTING_REGISTER_TYPE(x) \
static void __attribute__((constructor)) register_setting (void) \
{ g_type_init (); g_type_ensure (x); }
{ nm_g_type_init (); g_type_ensure (x); }
NMSetting *nm_setting_find_in_list (GSList *settings_list, const char *setting_name);

View file

@ -103,9 +103,7 @@ static void
_ensure_registered (void)
{
if (G_UNLIKELY (registered_settings == NULL)) {
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
_nm_value_transforms_register ();
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);

View file

@ -308,9 +308,7 @@ int main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
success = nm_utils_init (&error);
g_assert_no_error (error);

View file

@ -262,7 +262,7 @@ extern const char *_nm_device_factory_no_default_settings[];
static void __attribute__((constructor)) \
register_device_factory_internal_##lower (void) \
{ \
g_type_init (); \
nm_g_type_init (); \
g_type_ensure (NM_TYPE_##upper##_FACTORY); \
} \
\

View file

@ -44,6 +44,7 @@
#include "NetworkManagerUtils.h"
#include "nm-dhcp-listener.h"
#include "gsystem-local-alloc.h"
#include "nm-glib-compat.h"
G_DEFINE_TYPE (NMDhcpDhclient, nm_dhcp_dhclient, NM_TYPE_DHCP_CLIENT)
@ -669,7 +670,7 @@ nm_dhcp_dhclient_class_init (NMDhcpDhclientClass *dhclient_class)
static void __attribute__((constructor))
register_dhcp_dhclient (void)
{
g_type_init ();
nm_g_type_init ();
_nm_dhcp_client_register (NM_TYPE_DHCP_DHCLIENT,
"dhclient",
nm_dhcp_dhclient_get_path,

View file

@ -39,6 +39,7 @@
#include "nm-logging.h"
#include "NetworkManagerUtils.h"
#include "nm-dhcp-listener.h"
#include "nm-glib-compat.h"
G_DEFINE_TYPE (NMDhcpDhcpcd, nm_dhcp_dhcpcd, NM_TYPE_DHCP_CLIENT)
@ -213,7 +214,7 @@ nm_dhcp_dhcpcd_class_init (NMDhcpDhcpcdClass *dhcpcd_class)
static void __attribute__((constructor))
register_dhcp_dhclient (void)
{
g_type_init ();
nm_g_type_init ();
_nm_dhcp_client_register (NM_TYPE_DHCP_DHCPCD,
"dhcpcd",
nm_dhcp_dhcpcd_get_path,

View file

@ -846,7 +846,7 @@ nm_dhcp_systemd_class_init (NMDhcpSystemdClass *sdhcp_class)
static void __attribute__((constructor))
register_dhcp_dhclient (void)
{
g_type_init ();
nm_g_type_init ();
_nm_dhcp_client_register (NM_TYPE_DHCP_SYSTEMD,
"internal",
NULL,

View file

@ -273,9 +273,7 @@ main (int argc, char *argv[])
char *bad_domains = NULL;
NMConfigCmdLineOptions *config_cli;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
_nm_utils_is_manager_process = TRUE;

View file

@ -336,9 +336,7 @@ main (int argc, char *argv[])
gconstpointer tmp;
gs_free NMUtilsIPv6IfaceId *iid = NULL;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
setpgid (getpid (), getpid ());

View file

@ -123,9 +123,7 @@ dump_all (void)
int
main (int argc, char **argv)
{
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
g_assert (argc <= 2);
if (argc > 1 && !g_strcmp0 (argv[1], "--fake"))

View file

@ -6,15 +6,14 @@
#include "nm-fake-platform.h"
#include "nm-linux-platform.h"
#include "nm-logging.h"
#include "nm-glib-compat.h"
int
main (int argc, char **argv)
{
GMainLoop *loop;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
loop = g_main_loop_new (NULL, FALSE);
nm_logging_setup ("debug", NULL, NULL, NULL);

View file

@ -866,9 +866,7 @@ main (int argc, char **argv)
const command_t *command = NULL;
gboolean status = TRUE;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
if (*argv && !g_strcmp0 (argv[1], "--fake")) {
nm_fake_platform_setup ();

View file

@ -38,6 +38,7 @@
#include "nm-dbus-interface.h"
#include "nm-pppd-plugin.h"
#include "nm-ppp-status.h"
#include "nm-glib-compat.h"
int plugin_init (void);
@ -372,9 +373,7 @@ plugin_init (void)
GDBusConnection *bus;
GError *err = NULL;
#if !GLIB_CHECK_VERSION (2, 35, 0)
g_type_init ();
#endif
nm_g_type_init ();
g_message ("nm-ppp-plugin: (%s): initializing", __func__);