From e99973dfa29e1d10d98a11d7a290b9a687243e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Thu, 18 Jun 2015 22:08:06 +0200 Subject: [PATCH 1/2] Move to current GLib Set up glib to use the installed version for deprecation warnings instead of limiting ourselves to [2.30,2.34]; this will let us use newer API, and help us keep up to date with future deprecations. Then fix all the warnings (as of GLib 2.44.1). https://bugs.freedesktop.org/show_bug.cgi?id=91198 --- configure.ac | 4 ---- src/examples/cancel.c | 2 -- src/polkitagent/polkitagenthelperprivate.c | 2 -- src/polkitagent/polkitagentlistener.c | 6 ++---- src/polkitbackend/polkitd.c | 2 -- src/programs/pkaction.c | 2 -- src/programs/pkcheck.c | 2 -- src/programs/pkexec.c | 5 ----- src/programs/pkttyagent.c | 2 -- test/polkit/polkitidentitytest.c | 1 - test/polkit/polkitunixgrouptest.c | 1 - test/polkit/polkitunixnetgrouptest.c | 1 - test/polkit/polkitunixusertest.c | 1 - test/polkitbackend/test-polkitbackendjsauthority.c | 1 - 14 files changed, 2 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index 97d4222..761eee8 100644 --- a/configure.ac +++ b/configure.ac @@ -124,10 +124,6 @@ fi PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0]) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) -AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_30], - [Avoid warning spew about g_type_init() being deprecated]) -AC_DEFINE([GLIB_VERSION_MAX_ALLOWED], [G_ENCODE_VERSION(2,34)], - [Notify us when we'll need to transition away from g_type_init()]) AC_ARG_WITH(mozjs, AS_HELP_STRING([--with-mozjs=@<:@mozjs185/mozjs-17.0|auto@:>@], [Specify version of Spidermonkey to use]),, diff --git a/src/examples/cancel.c b/src/examples/cancel.c index 1470025..02a8b63 100644 --- a/src/examples/cancel.c +++ b/src/examples/cancel.c @@ -102,8 +102,6 @@ main (int argc, char *argv[]) PolkitAuthority *authority; GCancellable *cancellable; - g_type_init (); - if (argc != 2) { g_printerr ("usage: %s \n", argv[0]); diff --git a/src/polkitagent/polkitagenthelperprivate.c b/src/polkitagent/polkitagenthelperprivate.c index e23f9f5..1f32c0a 100644 --- a/src/polkitagent/polkitagenthelperprivate.c +++ b/src/polkitagent/polkitagenthelperprivate.c @@ -88,8 +88,6 @@ send_dbus_message (const char *cookie, const char *user) ret = FALSE; - g_type_init (); - error = NULL; authority = polkit_authority_get_sync (NULL /* GCancellable* */, &error); if (authority == NULL) diff --git a/src/polkitagent/polkitagentlistener.c b/src/polkitagent/polkitagentlistener.c index 4704b03..1431458 100644 --- a/src/polkitagent/polkitagentlistener.c +++ b/src/polkitagent/polkitagentlistener.c @@ -422,10 +422,8 @@ polkit_agent_listener_register_with_options (PolkitAgentListener *listener, if (flags & POLKIT_AGENT_REGISTER_FLAGS_RUN_IN_THREAD) { - server->thread = g_thread_create (server_thread_func, - server, - TRUE, - error); + server->thread = g_thread_try_new ("polkit agent listener", + server_thread_func, server, error); if (server->thread == NULL) { server_free (server); diff --git a/src/polkitbackend/polkitd.c b/src/polkitbackend/polkitd.c index 8d54ed7..2e215cc 100644 --- a/src/polkitbackend/polkitd.c +++ b/src/polkitbackend/polkitd.c @@ -173,8 +173,6 @@ main (int argc, /* Disable remote file access from GIO. */ setenv ("GIO_USE_VFS", "local", 1); - g_type_init (); - opt_context = g_option_context_new ("polkit system daemon"); g_option_context_add_main_entries (opt_context, opt_entries, NULL); error = NULL; diff --git a/src/programs/pkaction.c b/src/programs/pkaction.c index 221662a..6dd6877 100644 --- a/src/programs/pkaction.c +++ b/src/programs/pkaction.c @@ -125,8 +125,6 @@ main (int argc, char *argv[]) /* Disable remote file access from GIO. */ setenv ("GIO_USE_VFS", "local", 1); - g_type_init (); - opt_show_version = FALSE; opt_verbose = FALSE; diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c index 33db128..f1bb4e1 100644 --- a/src/programs/pkcheck.c +++ b/src/programs/pkcheck.c @@ -366,8 +366,6 @@ main (int argc, char *argv[]) /* Disable remote file access from GIO. */ setenv ("GIO_USE_VFS", "local", 1); - g_type_init (); - details = polkit_details_new (); opt_show_help = FALSE; diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c index 3b29b24..32c204d 100644 --- a/src/programs/pkexec.c +++ b/src/programs/pkexec.c @@ -707,11 +707,6 @@ main (int argc, char *argv[]) goto out; } - /* Initialize the GLib type system - this is needed to interact with the - * PolicyKit daemon - */ - g_type_init (); - /* make sure we are nuked if the parent process dies */ #ifdef __linux__ if (prctl (PR_SET_PDEATHSIG, SIGTERM) != 0) diff --git a/src/programs/pkttyagent.c b/src/programs/pkttyagent.c index 8aac7dd..a7c480f 100644 --- a/src/programs/pkttyagent.c +++ b/src/programs/pkttyagent.c @@ -78,8 +78,6 @@ main (int argc, char *argv[]) /* Disable remote file access from GIO. */ setenv ("GIO_USE_VFS", "local", 1); - g_type_init (); - error = NULL; context = g_option_context_new (""); s = g_strdup_printf (_("Report bugs to: %s\n" diff --git a/test/polkit/polkitidentitytest.c b/test/polkit/polkitidentitytest.c index 3b8dd5e..e91967b 100644 --- a/test/polkit/polkitidentitytest.c +++ b/test/polkit/polkitidentitytest.c @@ -170,7 +170,6 @@ add_comparison_tests (void) int main (int argc, char *argv[]) { - g_type_init (); g_test_init (&argc, &argv, NULL); g_test_add_data_func ("/PolkitIdentity/user_string_0", "unix-user:root", test_string); diff --git a/test/polkit/polkitunixgrouptest.c b/test/polkit/polkitunixgrouptest.c index f1417b3..6c4959e 100644 --- a/test/polkit/polkitunixgrouptest.c +++ b/test/polkit/polkitunixgrouptest.c @@ -73,7 +73,6 @@ test_set_gid (void) int main (int argc, char *argv[]) { - g_type_init (); g_test_init (&argc, &argv, NULL); g_test_add_func ("/PolkitUnixGroup/new", test_new); g_test_add_func ("/PolkitUnixGroup/new_for_name", test_new_for_name); diff --git a/test/polkit/polkitunixnetgrouptest.c b/test/polkit/polkitunixnetgrouptest.c index c67822e..3701ba1 100644 --- a/test/polkit/polkitunixnetgrouptest.c +++ b/test/polkit/polkitunixnetgrouptest.c @@ -68,7 +68,6 @@ test_set_name (void) int main (int argc, char *argv[]) { - g_type_init (); g_test_init (&argc, &argv, NULL); g_test_add_func ("/PolkitUnixNetgroup/new", test_new); g_test_add_func ("/PolkitUnixNetgroup/set_name", test_set_name); diff --git a/test/polkit/polkitunixusertest.c b/test/polkit/polkitunixusertest.c index ce35088..fc4c774 100644 --- a/test/polkit/polkitunixusertest.c +++ b/test/polkit/polkitunixusertest.c @@ -95,7 +95,6 @@ test_set_uid (void) int main (int argc, char *argv[]) { - g_type_init (); g_test_init (&argc, &argv, NULL); g_test_add_func ("/PolkitUnixUser/new", test_new); g_test_add_func ("/PolkitUnixUser/new_for_name", test_new_for_name); diff --git a/test/polkitbackend/test-polkitbackendjsauthority.c b/test/polkitbackend/test-polkitbackendjsauthority.c index dfb894f..984110c 100644 --- a/test/polkitbackend/test-polkitbackendjsauthority.c +++ b/test/polkitbackend/test-polkitbackendjsauthority.c @@ -403,7 +403,6 @@ main (int argc, char *argv[]) { setlocale (LC_ALL, ""); - g_type_init (); g_test_init (&argc, &argv, NULL); //polkit_test_redirect_logs (); -- 2.7.5