Gentoo Archives: gentoo-commits

From: Alexandre Restovtsev <tetromino@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc-settingsd:master commit in: src/
Date: Sun, 05 Feb 2012 00:20:53
Message-Id: 8f23cc229ef22542624b08b8b7f28219d0c3a5f8.tetromino@gentoo
1 commit: 8f23cc229ef22542624b08b8b7f28219d0c3a5f8
2 Author: Alexandre Rostovtsev <tetromino <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 5 00:01:35 2012 +0000
4 Commit: Alexandre Restovtsev <tetromino <AT> gmail <DOT> com>
5 CommitDate: Sun Feb 5 00:20:04 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc-settingsd.git;a=commit;h=8f23cc22
7
8 GStaticMutex is deprecated in glib-2.31
9
10 ---
11 src/hostnamed.c | 32 ++++++++++++++++----------------
12 1 files changed, 16 insertions(+), 16 deletions(-)
13
14 diff --git a/src/hostnamed.c b/src/hostnamed.c
15 index b431aac..d910fb0 100644
16 --- a/src/hostnamed.c
17 +++ b/src/hostnamed.c
18 @@ -43,12 +43,12 @@ gboolean read_only = FALSE;
19 static OpenrcSettingsdHostnamedHostname1 *hostname1 = NULL;
20
21 static gchar hostname[HOST_NAME_MAX + 1];
22 -static GStaticMutex hostname_mutex = G_STATIC_MUTEX_INIT;
23 +G_LOCK_DEFINE_STATIC (hostname);
24 static gchar *static_hostname = NULL;
25 -static GStaticMutex static_hostname_mutex = G_STATIC_MUTEX_INIT;
26 +G_LOCK_DEFINE_STATIC (static_hostname);
27 static gchar *pretty_hostname = NULL;
28 static gchar *icon_name = NULL;
29 -static GStaticMutex machine_info_mutex = G_STATIC_MUTEX_INIT;
30 +G_LOCK_DEFINE_STATIC (machine_info);
31
32 static gboolean
33 hostname_is_valid (const gchar *name)
34 @@ -123,7 +123,7 @@ on_handle_set_hostname (OpenrcSettingsdHostnamedHostname1 *hostname1,
35 goto end;
36 }
37
38 - g_static_mutex_lock (&hostname_mutex);
39 + G_LOCK (hostname);
40 /* Don't allow an empty or invalid hostname */
41 if (!hostname_is_valid (name)) {
42 name = hostname;
43 @@ -135,13 +135,13 @@ on_handle_set_hostname (OpenrcSettingsdHostnamedHostname1 *hostname1,
44 g_dbus_method_invocation_return_dbus_error (invocation,
45 DBUS_ERROR_FAILED,
46 strerror (errsv));
47 - g_static_mutex_unlock (&hostname_mutex);
48 + G_UNLOCK (hostname);
49 goto end;
50 }
51 g_strlcpy (hostname, name, HOST_NAME_MAX + 1);
52 openrc_settingsd_hostnamed_hostname1_complete_set_hostname (hostname1, invocation);
53 openrc_settingsd_hostnamed_hostname1_set_hostname (hostname1, hostname);
54 - g_static_mutex_unlock (&hostname_mutex);
55 + G_UNLOCK (hostname);
56
57 end:
58 return TRUE;
59 @@ -169,7 +169,7 @@ on_handle_set_static_hostname (OpenrcSettingsdHostnamedHostname1 *hostname1,
60 goto end;
61 }
62
63 - g_static_mutex_lock (&static_hostname_mutex);
64 + G_LOCK (static_hostname);
65 /* Don't allow an empty or invalid hostname */
66 if (!hostname_is_valid (name))
67 name = "localhost";
68 @@ -177,7 +177,7 @@ on_handle_set_static_hostname (OpenrcSettingsdHostnamedHostname1 *hostname1,
69 confd_file = shell_utils_trivial_new (SYSCONFDIR "/conf.d/hostname", &err);
70 if (confd_file == NULL) {
71 g_dbus_method_invocation_return_gerror (invocation, err);
72 - g_static_mutex_unlock (&static_hostname_mutex);
73 + G_UNLOCK (static_hostname);
74 goto end;
75 }
76
77 @@ -188,13 +188,13 @@ on_handle_set_static_hostname (OpenrcSettingsdHostnamedHostname1 *hostname1,
78 g_dbus_method_invocation_return_dbus_error (invocation,
79 DBUS_ERROR_FAILED,
80 "Failed to set static hostname in " SYSCONFDIR "/conf.d/hostname");
81 - g_static_mutex_unlock (&static_hostname_mutex);
82 + G_UNLOCK (static_hostname);
83 goto end;
84 }
85
86 if (!shell_utils_trivial_save (confd_file, &err)) {
87 g_dbus_method_invocation_return_gerror (invocation, err);
88 - g_static_mutex_unlock (&static_hostname_mutex);
89 + G_UNLOCK (static_hostname);
90 goto end;
91 }
92
93 @@ -202,7 +202,7 @@ on_handle_set_static_hostname (OpenrcSettingsdHostnamedHostname1 *hostname1,
94 static_hostname = g_strdup (name);
95 openrc_settingsd_hostnamed_hostname1_complete_set_static_hostname (hostname1, invocation);
96 openrc_settingsd_hostnamed_hostname1_set_static_hostname (hostname1, static_hostname);
97 - g_static_mutex_unlock (&static_hostname_mutex);
98 + G_UNLOCK (static_hostname);
99
100 end:
101 shell_utils_trivial_free (confd_file);
102 @@ -235,7 +235,7 @@ on_handle_set_machine_info (OpenrcSettingsdHostnamedHostname1 *hostname1,
103 goto end;
104 }
105
106 - g_static_mutex_lock (&machine_info_mutex);
107 + G_LOCK (machine_info);
108 /* Don't allow a null pretty hostname */
109 if (name == NULL)
110 name = "";
111 @@ -243,7 +243,7 @@ on_handle_set_machine_info (OpenrcSettingsdHostnamedHostname1 *hostname1,
112 confd_file = shell_utils_trivial_new (SYSCONFDIR "/machine-info", &err);
113 if (confd_file == NULL) {
114 g_dbus_method_invocation_return_gerror (invocation, err);
115 - g_static_mutex_unlock (&machine_info_mutex);
116 + G_UNLOCK (machine_info);
117 goto end;
118 }
119
120 @@ -253,13 +253,13 @@ on_handle_set_machine_info (OpenrcSettingsdHostnamedHostname1 *hostname1,
121 g_dbus_method_invocation_return_dbus_error (invocation,
122 DBUS_ERROR_FAILED,
123 "Failed to value in " SYSCONFDIR "/machine-info");
124 - g_static_mutex_unlock (&machine_info_mutex);
125 + G_UNLOCK (machine_info);
126 goto end;
127 }
128
129 if (!shell_utils_trivial_save (confd_file, &err)) {
130 g_dbus_method_invocation_return_gerror (invocation, err);
131 - g_static_mutex_unlock (&machine_info_mutex);
132 + G_UNLOCK (machine_info);
133 goto end;
134 }
135
136 @@ -274,7 +274,7 @@ on_handle_set_machine_info (OpenrcSettingsdHostnamedHostname1 *hostname1,
137 openrc_settingsd_hostnamed_hostname1_complete_set_icon_name (hostname1, invocation);
138 openrc_settingsd_hostnamed_hostname1_set_icon_name (hostname1, icon_name);
139 }
140 - g_static_mutex_unlock (&machine_info_mutex);
141 + G_UNLOCK (machine_info);
142
143 end:
144 shell_utils_trivial_free (confd_file);