summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-09-07 11:11:23 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-09-07 14:29:53 +0100
commit37609dd9849871633f84192a0ce4fe65c40784e6 (patch)
treef6304a0b93354ad87405f0369b9035bdac21def6
parenta729a511399712c4b8fbfbef9d3517aaaa4ad9d7 (diff)
Use G_VALUE_INIT instead of { 0 }
We already depend on GLib 2.30, which is new enough. Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Xavier Claessens <xavier.claessens@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54633
-rw-r--r--src/channel-utils.c2
-rw-r--r--src/mcd-account-manager-sso.c16
-rw-r--r--src/mcd-account-manager.c4
-rw-r--r--src/mcd-account.c38
-rw-r--r--src/mcd-channel.c6
-rw-r--r--src/mcd-dbusprop.c2
-rw-r--r--src/mcd-dispatcher.c6
-rw-r--r--src/mcd-storage.c2
-rw-r--r--tests/account-store-libaccounts.c14
-rw-r--r--tests/value-is-same.c16
10 files changed, 57 insertions, 49 deletions
diff --git a/src/channel-utils.c b/src/channel-utils.c
index 74a62a86..492b54be 100644
--- a/src/channel-utils.c
+++ b/src/channel-utils.c
@@ -82,7 +82,7 @@ static void
_channel_details_array_append (GPtrArray *channel_array, TpChannel *channel)
{
GType type = TP_STRUCT_TYPE_CHANNEL_DETAILS;
- GValue channel_val = { 0, };
+ GValue channel_val = G_VALUE_INIT;
GHashTable *properties;
const gchar *object_path;
diff --git a/src/mcd-account-manager-sso.c b/src/mcd-account-manager-sso.c
index 3be991e5..8e22dedc 100644
--- a/src/mcd-account-manager-sso.c
+++ b/src/mcd-account-manager-sso.c
@@ -348,7 +348,7 @@ _maybe_set_account_param_from_service (
{
Setting *setting = setting_data (AG_ACCOUNT_KEY, SETTING_AG);
AgSettingSource source = AG_SETTING_SOURCE_NONE;
- GValue ag_value = { 0 };
+ GValue ag_value = G_VALUE_INIT;
g_return_if_fail (setting != NULL);
g_return_if_fail (ag_account != NULL);
@@ -820,7 +820,7 @@ _ag_account_stored_cb (
gpointer user_data)
{
McdAccountManagerSso *self = MCD_ACCOUNT_MANAGER_SSO (user_data);
- GValue uid = { 0 };
+ GValue uid = G_VALUE_INIT;
const gchar *name = NULL;
AgSettingSource src = AG_SETTING_SOURCE_NONE;
@@ -849,7 +849,7 @@ _ag_accountid_to_mc_key (McdAccountManagerSso *sso,
AgAccount *account = ag_manager_get_account (sso->ag_manager, id);
AgSettingSource src = AG_SETTING_SOURCE_NONE;
AgService *service = NULL;
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
if (account == NULL)
{
@@ -896,8 +896,8 @@ _ag_accountid_to_mc_key (McdAccountManagerSso *sso,
AgAccountSettingIter iter;
const gchar *k;
const GValue *v;
- GValue cmanager = { 0 };
- GValue protocol = { 0 };
+ GValue cmanager = G_VALUE_INIT;
+ GValue protocol = G_VALUE_INIT;
const gchar *cman, *proto;
McpAccountManager *am = sso->manager_interface;
GHashTable *params = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -1035,7 +1035,7 @@ save_setting (
if (setting->readable)
{
- GValue old = { 0 };
+ GValue old = G_VALUE_INIT;
AgSettingSource src = AG_SETTING_SOURCE_NONE;
g_value_init (&old, G_TYPE_STRING);
@@ -1068,7 +1068,7 @@ save_setting (
if (val != NULL)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, val);
@@ -1186,7 +1186,7 @@ account_manager_sso_get_one (
}
else
{
- GValue v = { 0 };
+ GValue v = G_VALUE_INIT;
AgSettingSource src = AG_SETTING_SOURCE_NONE;
Setting *setting = setting_data (key, SETTING_MC);
diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c
index 9a12d1b9..e7b2161c 100644
--- a/src/mcd-account-manager.c
+++ b/src/mcd-account-manager.c
@@ -1237,8 +1237,8 @@ migrate_butterfly_haze_ready (McdManager *manager,
{
MigrateCtx *ctx = user_data;
gchar *display_name;
- GValue v = {0,};
- GValue password_v = {0,};
+ GValue v = G_VALUE_INIT;
+ GValue password_v = G_VALUE_INIT;
GHashTable *parameters, *properties;
gchar *str;
GPtrArray *supersedes;
diff --git a/src/mcd-account.c b/src/mcd-account.c
index a07e1265..9a343234 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -855,7 +855,7 @@ mcd_account_request_presence_int (McdAccount *account,
if (changed)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
g_value_init (&value, TP_STRUCT_TYPE_SIMPLE_PRESENCE);
g_value_take_boxed (&value,
@@ -1194,7 +1194,7 @@ _mcd_account_set_enabled (McdAccount *account,
if (priv->enabled != enabled)
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
const gchar *name = mcd_account_get_unique_name (account);
if (!enabled && priv->connection != NULL)
@@ -1485,7 +1485,7 @@ set_automatic_presence (TpSvcDBusProperties *self,
if (priv->auto_presence_type != type)
{
- GValue presence = { 0 };
+ GValue presence = G_VALUE_INIT;
g_value_init (&presence, G_TYPE_INT);
g_value_set_int (&presence, type);
@@ -1898,7 +1898,7 @@ get_storage_identifier (TpSvcDBusProperties *self,
McdAccount *account = MCD_ACCOUNT (self);
McpAccountStorage *storage_plugin = get_storage_plugin (account);
- GValue identifier = { 0 };
+ GValue identifier = G_VALUE_INIT;
g_value_init (value, G_TYPE_VALUE);
@@ -2308,7 +2308,7 @@ mcd_account_property_changed (McdAccount *account, const gchar *name)
if (prop->getprop != NULL)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
prop->getprop (self, name, &value);
@@ -2487,7 +2487,7 @@ check_one_parameter_update (McdAccount *account,
if (mcd_account_get_connection_status (account) ==
TP_CONNECTION_STATUS_CONNECTED)
{
- GValue current_value = { 0, };
+ GValue current_value = G_VALUE_INIT;
/* Check if the parameter's current value (or its default, if it has
* one and it's not set to anything) matches the new value.
@@ -2533,7 +2533,7 @@ check_one_parameter_unset (McdAccount *account,
mcd_account_get_connection_status (account) ==
TP_CONNECTION_STATUS_CONNECTED)
{
- GValue current_value = { 0, };
+ GValue current_value = G_VALUE_INIT;
if (mcd_account_get_parameter (account, param->name, &current_value,
NULL))
@@ -2541,7 +2541,7 @@ check_one_parameter_unset (McdAccount *account,
/* There's an existing value; let's see if it's the same as the
* default, if any.
*/
- GValue default_value = { 0, };
+ GValue default_value = G_VALUE_INIT;
if (tp_connection_manager_param_get_default (param, &default_value))
{
@@ -2679,7 +2679,7 @@ account_update_parameters_cb (McdAccount *account, GPtrArray *not_yet,
DBusGMethodInvocation *context = (DBusGMethodInvocation *) user_data;
const gchar *account_name = mcd_account_get_unique_name (account);
GHashTable *params;
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
if (error != NULL)
{
@@ -3362,7 +3362,7 @@ _mcd_account_dup_parameters (McdAccount *account)
for (param = protocol->params; param->name != NULL; param++)
{
- GValue v = { 0, };
+ GValue v = G_VALUE_INIT;
if (mcd_account_get_parameter (account, param->name, &v, NULL))
{
@@ -3403,7 +3403,7 @@ mcd_account_update_self_presence (McdAccount *account,
{
McdAccountPrivate *priv = account->priv;
gboolean changed = FALSE;
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
if (priv->curr_presence_type != presence)
{
@@ -3581,7 +3581,7 @@ void
_mcd_account_set_normalized_name (McdAccount *account, const gchar *name)
{
McdAccountPrivate *priv = account->priv;
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
const gchar *account_name = mcd_account_get_unique_name (account);
DEBUG ("called (%s)", name);
@@ -3756,7 +3756,7 @@ mcd_account_connection_self_nickname_changed_cb (McdAccount *account,
const gchar *alias,
McdConnection *connection)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRING);
g_value_set_static_string (&value, alias);
@@ -3852,7 +3852,7 @@ clear_register (McdAccount *self)
if (tp_asv_get_boolean (params, "register", NULL))
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
const gchar *account_name = mcd_account_get_unique_name (self);
_mcd_account_set_parameter (self, "register", NULL);
@@ -3961,7 +3961,7 @@ _mcd_account_set_connection_status (McdAccount *account,
if (changed)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
_mcd_account_tp_connection_changed (account, priv->tp_connection);
@@ -4009,7 +4009,7 @@ void
_mcd_account_tp_connection_changed (McdAccount *account,
TpConnection *tp_conn)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
g_value_init (&value, DBUS_TYPE_G_OBJECT_PATH);
@@ -4060,7 +4060,7 @@ check_validity_check_parameters_cb (McdAccount *account,
if (was_valid != now_valid)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
DEBUG ("Account validity changed (old: %d, new: %d)",
was_valid, now_valid);
g_signal_emit (account, _mcd_account_signals[VALIDITY_CHANGED], 0,
@@ -4346,7 +4346,7 @@ _mcd_account_set_has_been_online (McdAccount *account)
{
if (!account->priv->has_been_online)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
const gchar *account_name = mcd_account_get_unique_name (account);
g_value_init (&value, G_TYPE_BOOLEAN);
@@ -4469,7 +4469,7 @@ void
_mcd_account_set_changing_presence (McdAccount *self, gboolean value)
{
McdAccountPrivate *priv = self->priv;
- GValue changing_presence = { 0 };
+ GValue changing_presence = G_VALUE_INIT;
priv->changing_presence = value;
diff --git a/src/mcd-channel.c b/src/mcd-channel.c
index e32281e8..3d6b0660 100644
--- a/src/mcd-channel.c
+++ b/src/mcd-channel.c
@@ -657,9 +657,9 @@ mcd_channel_new_from_path (TpConnection *connection, const gchar *object_path,
TpHandleType handle_type)
{
GHashTable *props;
- GValue v_type = { 0 };
- GValue v_handle = { 0 };
- GValue v_handle_type = { 0 };
+ GValue v_type = G_VALUE_INIT;
+ GValue v_handle = G_VALUE_INIT;
+ GValue v_handle_type = G_VALUE_INIT;
McdChannel *channel;
props = g_hash_table_new (g_str_hash, g_str_equal);
diff --git a/src/mcd-dbusprop.c b/src/mcd-dbusprop.c
index 01307f66..f15bd85b 100644
--- a/src/mcd-dbusprop.c
+++ b/src/mcd-dbusprop.c
@@ -236,7 +236,7 @@ dbusprop_get (TpSvcDBusProperties *self,
const gchar *property_name,
DBusGMethodInvocation *context)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
GError *error = NULL;
DEBUG ("%s, %s", interface_name, property_name);
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index c7f3c7a3..48ebc833 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -1719,9 +1719,9 @@ messages_send_message_start (DBusGMethodInvocation *dbus_context,
McdRequest *request = NULL;
GError *error = NULL;
GHashTable *props = NULL;
- GValue c_type = { 0 };
- GValue h_type = { 0 };
- GValue target = { 0 };
+ GValue c_type = G_VALUE_INIT;
+ GValue h_type = G_VALUE_INIT;
+ GValue target = G_VALUE_INIT;
McdDispatcher *self = message->dispatcher;
DEBUG ("messages_send_message_acl_success [attempt #%u]", message->tries);
diff --git a/src/mcd-storage.c b/src/mcd-storage.c
index 814474c0..0ab1ff2e 100644
--- a/src/mcd-storage.c
+++ b/src/mcd-storage.c
@@ -1154,7 +1154,7 @@ mcd_storage_set_strv (McdStorage *storage,
const gchar * const *strv,
gboolean secret)
{
- GValue v = { 0, };
+ GValue v = G_VALUE_INIT;
static const gchar * const *empty = { NULL };
gboolean ret;
diff --git a/tests/account-store-libaccounts.c b/tests/account-store-libaccounts.c
index 249b8476..e2756969 100644
--- a/tests/account-store-libaccounts.c
+++ b/tests/account-store-libaccounts.c
@@ -250,7 +250,7 @@ get_ag_account (const gchar *mc_account)
if (account != NULL)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
AgSettingSource source = AG_SETTING_SOURCE_NONE;
g_value_init (&value, G_TYPE_STRING);
@@ -370,7 +370,7 @@ save_setting (AgAccount *account,
if (val != NULL)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, val);
@@ -416,7 +416,7 @@ libaccounts_get (const gchar *mc_account, const gchar *key)
}
else
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
AgSettingSource source = AG_SETTING_SOURCE_NONE;
g_value_init (&value, G_TYPE_STRING);
@@ -567,7 +567,7 @@ libaccounts_list (void)
for (id = ag_ids; id && i < len; id = g_list_next (id))
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
AgAccountId uid = GPOINTER_TO_UINT (id->data);
AgAccount *ag_account = ag_manager_get_account (ag_manager, uid);
AgSettingSource source = AG_SETTING_SOURCE_NONE;
@@ -589,9 +589,9 @@ libaccounts_list (void)
}
else
{
- GValue cmanager = { 0 };
- GValue protocol = { 0 };
- GValue account = { 0 };
+ GValue cmanager = G_VALUE_INIT;
+ GValue protocol = G_VALUE_INIT;
+ GValue account = G_VALUE_INIT;
const gchar *acct = NULL;
const gchar *cman = NULL;
const gchar *proto = NULL;
diff --git a/tests/value-is-same.c b/tests/value-is-same.c
index f0b5c36d..1f7854ba 100644
--- a/tests/value-is-same.c
+++ b/tests/value-is-same.c
@@ -57,7 +57,9 @@ assert_and_reset (GValue *value, GValue *same, GValue *different)
static void
test_numeric (void)
{
- GValue value = { 0 }, same = { 0 }, different = { 0 };
+ GValue value = G_VALUE_INIT;
+ GValue same = G_VALUE_INIT;
+ GValue different = G_VALUE_INIT;
g_value_set_int (g_value_init (&value, G_TYPE_INT), -42);
g_value_set_int (g_value_init (&same, G_TYPE_INT), -42);
@@ -103,7 +105,9 @@ test_numeric (void)
static void
test_string (void)
{
- GValue value = { 0 }, same = { 0 }, different = { 0 };
+ GValue value = G_VALUE_INIT;
+ GValue same = G_VALUE_INIT;
+ GValue different = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRING);
g_value_init (&same, G_TYPE_STRING);
@@ -132,7 +136,9 @@ test_string (void)
static void
test_object_path (void)
{
- GValue value = { 0 }, same = { 0 }, different = { 0 };
+ GValue value = G_VALUE_INIT;
+ GValue same = G_VALUE_INIT;
+ GValue different = G_VALUE_INIT;
g_value_init (&value, DBUS_TYPE_G_OBJECT_PATH);
g_value_init (&same, DBUS_TYPE_G_OBJECT_PATH);
@@ -154,7 +160,9 @@ test_strv (void)
const gchar * const empty[] = { NULL };
const gchar * const small[] = { "foo", "bar", NULL };
const gchar * const large[] = { "foo", "bar", "baz", NULL };
- GValue value = { 0 }, same = { 0 }, different = { 0 };
+ GValue value = G_VALUE_INIT;
+ GValue same = G_VALUE_INIT;
+ GValue different = G_VALUE_INIT;
g_value_init (&value, G_TYPE_STRV);
g_value_init (&same, G_TYPE_STRV);