summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2013-03-22 10:49:19 +0100
committerJiří Klimeš <jklimes@redhat.com>2013-03-25 08:41:18 +0100
commit82fb1978a45e61aaaf9d74042e6262b648bdd548 (patch)
tree5144bb0b8b25de63da8a8ca207d80be70dc745dd
parenta78a1847c6ccf9a95d46b9b819a8988d1d89f11c (diff)
downloadNetworkManager-82fb1978a45e61aaaf9d74042e6262b648bdd548.tar.gz
all: use G_VALUE_INIT to initialize GValue variables
It makes the initializations more explicit. G_VALUE_INIT is available since glib 2.30, and NM now require glib >= 2.32
-rw-r--r--callouts/nm-dispatcher-action.c2
-rw-r--r--cli/src/connections.c2
-rw-r--r--examples/C/glib/get-active-connections-dbus-glib.c6
-rw-r--r--libnm-glib/nm-active-connection.c2
-rw-r--r--libnm-glib/nm-client.c6
-rw-r--r--libnm-glib/nm-device.c4
-rw-r--r--libnm-glib/nm-object.c6
-rw-r--r--libnm-util/nm-param-spec-specialized.c34
-rw-r--r--libnm-util/nm-setting.c16
-rw-r--r--libnm-util/nm-utils.c6
-rw-r--r--libnm-util/tests/test-general.c4
-rw-r--r--libnm-util/tests/test-settings-defaults.c4
-rw-r--r--src/modem-manager/nm-modem-generic.c2
-rw-r--r--src/nm-device-bridge.c2
-rw-r--r--src/nm-device-wifi.c4
-rw-r--r--src/nm-device.c4
-rw-r--r--src/nm-properties-changed-signal.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/writer.c2
-rw-r--r--src/settings/plugins/keyfile/reader.c2
-rw-r--r--src/supplicant-manager/nm-supplicant-interface.c2
-rw-r--r--tools/generate-settings-spec.c2
21 files changed, 57 insertions, 57 deletions
diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c
index a3cb934c85..a9ed37ada2 100644
--- a/callouts/nm-dispatcher-action.c
+++ b/callouts/nm-dispatcher-action.c
@@ -175,7 +175,7 @@ next_script (gpointer user_data)
results = g_ptr_array_sized_new (request->scripts->len);
for (i = 0; i < request->scripts->len; i++) {
ScriptInfo *script = g_ptr_array_index (request->scripts, i);
- GValue elt = {0, };
+ GValue elt = G_VALUE_INIT;
item = g_value_array_new (3);
diff --git a/cli/src/connections.c b/cli/src/connections.c
index b39b447eaf..33e06d1d8c 100644
--- a/cli/src/connections.c
+++ b/cli/src/connections.c
@@ -1257,7 +1257,7 @@ dbus_get_vpn_state (const char *path)
DBusGConnection *connection;
DBusGProxy *proxy;
GError *error = NULL;
- GValue value = {0,};
+ GValue value = G_VALUE_INIT;
NMVPNConnectionState state = NM_VPN_CONNECTION_STATE_UNKNOWN;
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
diff --git a/examples/C/glib/get-active-connections-dbus-glib.c b/examples/C/glib/get-active-connections-dbus-glib.c
index f27c44fba9..d6bd15c708 100644
--- a/examples/C/glib/get-active-connections-dbus-glib.c
+++ b/examples/C/glib/get-active-connections-dbus-glib.c
@@ -98,8 +98,8 @@ static void
get_active_connection_details (DBusGConnection *bus, const char *obj_path)
{
DBusGProxy *props_proxy;
- GValue path_value = { 0 };
- GValue serv_value = { 0 };
+ GValue path_value = G_VALUE_INIT;
+ GValue serv_value = G_VALUE_INIT;
GError *error = NULL;
const char *path = NULL, *service = NULL;
@@ -179,7 +179,7 @@ static void
get_active_connections (DBusGConnection *bus, DBusGProxy *proxy)
{
GError *error = NULL;
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
GPtrArray *paths = NULL;
int i;
diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c
index f170121b50..65f9ea9512 100644
--- a/libnm-glib/nm-active-connection.c
+++ b/libnm-glib/nm-active-connection.c
@@ -111,7 +111,7 @@ _nm_active_connection_type_for_path (DBusGConnection *connection,
{
DBusGProxy *proxy;
GError *error = NULL;
- GValue value = {0,};
+ GValue value = G_VALUE_INIT;
GType type;
proxy = dbus_g_proxy_new_for_name (connection,
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index 3ffa7b9ee6..5a0111bf13 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -768,7 +768,7 @@ nm_client_wireless_get_enabled (NMClient *client)
void
nm_client_wireless_set_enabled (NMClient *client, gboolean enabled)
{
- GValue value = {0,};
+ GValue value = G_VALUE_INIT;
g_return_if_fail (NM_IS_CLIENT (client));
@@ -825,7 +825,7 @@ nm_client_wwan_get_enabled (NMClient *client)
void
nm_client_wwan_set_enabled (NMClient *client, gboolean enabled)
{
- GValue value = {0,};
+ GValue value = G_VALUE_INIT;
g_return_if_fail (NM_IS_CLIENT (client));
@@ -882,7 +882,7 @@ nm_client_wimax_get_enabled (NMClient *client)
void
nm_client_wimax_set_enabled (NMClient *client, gboolean enabled)
{
- GValue value = {0,};
+ GValue value = G_VALUE_INIT;
g_return_if_fail (NM_IS_CLIENT (client));
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index bbd1493c5f..8fee119471 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -845,7 +845,7 @@ _nm_device_type_for_path (DBusGConnection *connection,
{
DBusGProxy *proxy;
GError *err = NULL;
- GValue value = {0,};
+ GValue value = G_VALUE_INIT;
NMDeviceType nm_dtype;
proxy = dbus_g_proxy_new_for_name (connection,
@@ -1146,7 +1146,7 @@ nm_device_get_autoconnect (NMDevice *device)
void
nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect)
{
- GValue value = {0,};
+ GValue value = G_VALUE_INIT;
g_return_if_fail (NM_IS_DEVICE (device));
diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c
index af659bd1b9..97b95e4bb4 100644
--- a/libnm-glib/nm-object.c
+++ b/libnm-glib/nm-object.c
@@ -1090,7 +1090,7 @@ _nm_object_reload_property (NMObject *object,
const char *interface,
const char *prop_name)
{
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
GError *err = NULL;
g_return_if_fail (NM_IS_OBJECT (object));
@@ -1281,7 +1281,7 @@ _nm_object_reload_pseudo_property (NMObject *object,
PseudoPropertyInfo *ppi;
GPtrArray *temp;
GError *error = NULL;
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
g_return_if_fail (NM_IS_OBJECT (object));
g_return_if_fail (name != NULL);
@@ -1365,7 +1365,7 @@ reload_got_pseudo_property (DBusGProxy *proxy, DBusGProxyCall *call,
NMObject *object = ppi->self;
NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object);
GPtrArray *temp;
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
GError *error = NULL;
if (dbus_g_proxy_end_call (proxy, call, &error,
diff --git a/libnm-util/nm-param-spec-specialized.c b/libnm-util/nm-param-spec-specialized.c
index 06d56f04ee..9a671a2e87 100644
--- a/libnm-util/nm-param-spec-specialized.c
+++ b/libnm-util/nm-param-spec-specialized.c
@@ -649,8 +649,8 @@ _nm_param_spec_specialized (const char *name,
static void
compare_ints (void)
{
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
g_value_init (&value1, G_TYPE_INT);
g_value_init (&value2, G_TYPE_INT);
@@ -669,8 +669,8 @@ compare_ints (void)
static void
compare_strings (void)
{
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
const char *str1 = "hello";
const char *str2 = "world";
@@ -688,8 +688,8 @@ compare_strings (void)
static void
compare_strv (void)
{
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
char *strv1[] = { "foo", "bar", "baz", NULL };
char *strv2[] = { "foo", "bar", "bar", NULL };
char *strv3[] = { "foo", "bar", NULL };
@@ -717,8 +717,8 @@ compare_garrays (void)
{
GArray *array1;
GArray *array2;
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
int i;
g_value_init (&value1, DBUS_TYPE_G_UINT_ARRAY);
@@ -752,8 +752,8 @@ compare_ptrarrays (void)
{
GPtrArray *array1;
GPtrArray *array2;
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
g_value_init (&value1, dbus_g_type_get_collection ("GPtrArray", G_TYPE_STRING));
array1 = g_ptr_array_new ();
@@ -785,8 +785,8 @@ compare_str_hash (void)
{
GHashTable *hash1;
GHashTable *hash2;
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
g_value_init (&value1, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING));
g_value_init (&value2, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_STRING));
@@ -842,8 +842,8 @@ compare_gvalue_hash (void)
{
GHashTable *hash1;
GHashTable *hash2;
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
g_value_init (&value1, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE));
g_value_init (&value2, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE));
@@ -879,9 +879,9 @@ compare_ip6_addresses (void)
GByteArray *ba1;
GByteArray *ba2;
GByteArray *ba3;
- GValue element = { 0 };
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue element = G_VALUE_INIT;
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
struct in6_addr addr1;
struct in6_addr addr2;
struct in6_addr addr3;
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c
index 0d134ead15..b4e3b86a7a 100644
--- a/libnm-util/nm-setting.c
+++ b/libnm-util/nm-setting.c
@@ -316,8 +316,8 @@ compare_property (NMSetting *setting,
const GParamSpec *prop_spec,
NMSettingCompareFlags flags)
{
- GValue value1 = { 0 };
- GValue value2 = { 0 };
+ GValue value1 = G_VALUE_INIT;
+ GValue value2 = G_VALUE_INIT;
gboolean different;
/* Handle compare flags */
@@ -510,7 +510,7 @@ nm_setting_diff (NMSetting *a,
for (i = 0; i < n_property_specs; i++) {
GParamSpec *prop_spec = property_specs[i];
- GValue a_value = { 0 }, b_value = { 0 };
+ GValue a_value = G_VALUE_INIT, b_value = G_VALUE_INIT;
NMSettingDiffResult r = NM_SETTING_DIFF_RESULT_UNKNOWN, tmp;
gboolean different = TRUE;
@@ -580,7 +580,7 @@ nm_setting_enumerate_values (NMSetting *setting,
property_specs = g_object_class_list_properties (G_OBJECT_GET_CLASS (setting), &n_property_specs);
for (i = 0; i < n_property_specs; i++) {
GParamSpec *prop_spec = property_specs[i];
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop_spec));
g_object_get_property (G_OBJECT (setting), prop_spec->name, &value);
@@ -612,7 +612,7 @@ nm_setting_clear_secrets (NMSetting *setting)
for (i = 0; i < n_property_specs; i++) {
GParamSpec *prop_spec = property_specs[i];
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
if (prop_spec->flags & NM_SETTING_PARAM_SECRET) {
g_value_init (&value, prop_spec->value_type);
@@ -631,7 +631,7 @@ clear_secrets_with_flags (NMSetting *setting,
NMSettingClearSecretsWithFlagsFn func,
gpointer user_data)
{
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
NMSettingSecretFlags flags = NM_SETTING_SECRET_FLAG_NONE;
/* Clear the secret if the user function says to do so */
@@ -710,7 +710,7 @@ static gboolean
update_one_secret (NMSetting *setting, const char *key, GValue *value, GError **error)
{
GParamSpec *prop_spec;
- GValue transformed_value = { 0 };
+ GValue transformed_value = G_VALUE_INIT;
gboolean success = FALSE;
prop_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), key);
@@ -929,7 +929,7 @@ nm_setting_to_string (NMSetting *setting)
for (i = 0; i < n_property_specs; i++) {
GParamSpec *prop_spec = property_specs[i];
- GValue value = { 0 };
+ GValue value = G_VALUE_INIT;
char *value_str;
gboolean is_serializable;
gboolean is_default;
diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c
index 16a27d6523..aa47788544 100644
--- a/libnm-util/nm-utils.c
+++ b/libnm-util/nm-utils.c
@@ -1091,7 +1091,7 @@ _nm_utils_convert_old_ip6_addr_array (const GValue *src_value, GValue *dst_value
for (i = 0; src_outer_array && (i < src_outer_array->len); i++) {
GValueArray *src_addr_array;
GValueArray *dst_addr_array;
- GValue element = {0, };
+ GValue element = G_VALUE_INIT;
GValue *src_addr, *src_prefix;
GByteArray *ba;
@@ -1867,7 +1867,7 @@ nm_utils_ip6_addresses_to_gvalue (GSList *list, GValue *value)
for (iter = list; iter; iter = iter->next) {
NMIP6Address *addr = (NMIP6Address *) iter->data;
GValueArray *array;
- GValue element = {0, };
+ GValue element = G_VALUE_INIT;
GByteArray *ba;
array = g_value_array_new (3);
@@ -1991,7 +1991,7 @@ nm_utils_ip6_routes_to_gvalue (GSList *list, GValue *value)
GValueArray *array;
const struct in6_addr *addr;
GByteArray *ba;
- GValue element = {0, };
+ GValue element = G_VALUE_INIT;
array = g_value_array_new (4);
diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c
index f3d28e8965..536097241f 100644
--- a/libnm-util/tests/test-general.c
+++ b/libnm-util/tests/test-general.c
@@ -145,7 +145,7 @@ test_setting_vpn_update_secrets (void)
NMConnection *connection;
NMSettingVPN *s_vpn;
GHashTable *settings, *vpn, *secrets;
- GValue val = { 0 };
+ GValue val = G_VALUE_INIT;
gboolean success;
GError *error = NULL;
const char *tmp;
@@ -280,7 +280,7 @@ test_setting_ip6_config_old_address_array (void)
NMSettingIP6Config *s_ip6;
GPtrArray *addresses, *read_addresses;
GValueArray *array, *read_array;
- GValue element = {0, }, written_value = {0, }, read_value = {0, };
+ GValue element = G_VALUE_INIT, written_value = G_VALUE_INIT, read_value = G_VALUE_INIT;
GByteArray *ba;
const guint8 addr[16] = { 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11,
0x11, 0x22, 0x33, 0x44, 0x66, 0x77, 0x88, 0x99 };
diff --git a/libnm-util/tests/test-settings-defaults.c b/libnm-util/tests/test-settings-defaults.c
index b77ddfef9b..98c7332c57 100644
--- a/libnm-util/tests/test-settings-defaults.c
+++ b/libnm-util/tests/test-settings-defaults.c
@@ -57,8 +57,8 @@ test_defaults (GType type, const char *name)
for (i = 0; i < n_property_specs; i++) {
GParamSpec *prop_spec = property_specs[i];
- GValue value = { 0, };
- GValue defvalue = { 0, };
+ GValue value = G_VALUE_INIT;
+ GValue defvalue = G_VALUE_INIT;
char *actual, *expected;
gboolean ok = FALSE;
diff --git a/src/modem-manager/nm-modem-generic.c b/src/modem-manager/nm-modem-generic.c
index 4816ba98f7..ef101b6c8b 100644
--- a/src/modem-manager/nm-modem-generic.c
+++ b/src/modem-manager/nm-modem-generic.c
@@ -92,7 +92,7 @@ get_mm_enabled_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_d
{
NMModem *self = NM_MODEM (user_data);
GError *error = NULL;
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
if (!dbus_g_proxy_end_call (proxy, call_id, &error,
G_TYPE_VALUE, &value,
diff --git a/src/nm-device-bridge.c b/src/nm-device-bridge.c
index 9b8719c159..fba276cb5d 100644
--- a/src/nm-device-bridge.c
+++ b/src/nm-device-bridge.c
@@ -222,7 +222,7 @@ set_sysfs_uint (const char *iface,
{
char *path, *s;
GParamSpec *pspec;
- GValue val = { 0 };
+ GValue val = G_VALUE_INIT;
guint32 uval = 0;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (obj), obj_prop);
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 7ac2acf7af..30ef43a9f8 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -1636,8 +1636,8 @@ scanning_allowed_accumulator (GSignalInvocationHint *ihint,
static gboolean
check_scanning_allowed (NMDeviceWifi *self)
{
- GValue instance = { 0, };
- GValue retval = { 0, };
+ GValue instance = G_VALUE_INIT;
+ GValue retval = G_VALUE_INIT;
g_value_init (&instance, G_TYPE_OBJECT);
g_value_take_object (&instance, self);
diff --git a/src/nm-device.c b/src/nm-device.c
index 6ce61f737e..fe0e55a0a8 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -1357,8 +1357,8 @@ gboolean
nm_device_autoconnect_allowed (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
- GValue instance = { 0, };
- GValue retval = { 0, };
+ GValue instance = G_VALUE_INIT;
+ GValue retval = G_VALUE_INIT;
g_value_init (&instance, G_TYPE_OBJECT);
g_value_take_object (&instance, self);
diff --git a/src/nm-properties-changed-signal.c b/src/nm-properties-changed-signal.c
index 871d1bb00e..ab679792cc 100644
--- a/src/nm-properties-changed-signal.c
+++ b/src/nm-properties-changed-signal.c
@@ -75,7 +75,7 @@ static void
add_to_string (gpointer key, gpointer value, gpointer user_data)
{
char *buf = (char *) user_data;
- GValue str_val = { 0, };
+ GValue str_val = G_VALUE_INIT;
g_value_init (&str_val, G_TYPE_STRING);
if (!g_value_transform ((GValue *) value, &str_val)) {
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index e4e4552692..ed91d30ea3 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -1291,7 +1291,7 @@ static guint32
get_setting_default (NMSetting *setting, const char *prop)
{
GParamSpec *pspec;
- GValue val = { 0 };
+ GValue val = G_VALUE_INIT;
guint32 ret = 0;
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), prop);
diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugins/keyfile/reader.c
index bd63f517a0..0b204eb48f 100644
--- a/src/settings/plugins/keyfile/reader.c
+++ b/src/settings/plugins/keyfile/reader.c
@@ -132,7 +132,7 @@ build_ip6_address_or_route (const char *address_str, guint32 plen, const char *g
struct in6_addr addr;
GByteArray *address;
GByteArray *gateway;
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
int err;
g_return_val_if_fail (address_str, NULL);
diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c
index 92920d31c9..a2170990ee 100644
--- a/src/supplicant-manager/nm-supplicant-interface.c
+++ b/src/supplicant-manager/nm-supplicant-interface.c
@@ -1276,7 +1276,7 @@ nm_supplicant_interface_set_config (NMSupplicantInterface * self,
NMSupplicantInterfacePrivate *priv;
NMSupplicantInfo *info;
DBusGProxyCall *call;
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), FALSE);
diff --git a/tools/generate-settings-spec.c b/tools/generate-settings-spec.c
index 5281dcbf3e..76d97cf383 100644
--- a/tools/generate-settings-spec.c
+++ b/tools/generate-settings-spec.c
@@ -138,7 +138,7 @@ write_one_setting (FILE *f, gboolean book, SettingNewFunc func)
const char *key_name, *value_type, *value_desc;
char *default_value;
TypeNameElement *name_iter;
- GValue value = { 0, };
+ GValue value = G_VALUE_INIT;
char *flags_str = NULL;
value_type = g_type_name (G_PARAM_SPEC_VALUE_TYPE (*iter));