summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-09-02 17:45:31 +0200
committerThomas Haller <thaller@redhat.com>2020-09-02 17:46:45 +0200
commiteda1ef424280f16b53d5a9433103b34010731c88 (patch)
tree14a01816672c278a391e7ce852e597af787b3f29
parent715392a45e22791d54496916c8b01079776aa513 (diff)
parent15be2bb3fd31a627e0ddb3cb10158b2ddd663abd (diff)
downloadNetworkManager-eda1ef424280f16b53d5a9433103b34010731c88.tar.gz
all: merge branch 'th/unify-nm-auto-macros'
-rw-r--r--clients/cli/connections.c2
-rw-r--r--clients/common/nm-secret-agent-simple.c2
-rw-r--r--dispatcher/tests/test-dispatcher-envp.c2
-rw-r--r--libnm-core/nm-keyfile/nm-keyfile.c2
-rw-r--r--libnm-core/tests/test-keyfile.c12
-rw-r--r--libnm-core/tests/test-setting.c12
-rw-r--r--shared/nm-glib-aux/nm-macros-internal.h132
-rw-r--r--shared/nm-utils/nm-test-utils.h6
-rw-r--r--src/initrd/nm-initrd-generator.c2
-rw-r--r--src/nm-config-data.c2
-rw-r--r--src/nm-config.c18
-rw-r--r--src/settings/plugins/keyfile/nms-keyfile-reader.c2
-rw-r--r--src/settings/plugins/keyfile/nms-keyfile-utils.c4
-rw-r--r--src/settings/plugins/keyfile/nms-keyfile-writer.c2
-rw-r--r--src/settings/plugins/keyfile/tests/test-keyfile-settings.c14
-rw-r--r--src/tests/test-core.c6
16 files changed, 80 insertions, 140 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index 9ff6a393ec..3878264b2d 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -6322,7 +6322,7 @@ load_history_cmds (const char *uuid)
static void
save_history_cmds (const char *uuid)
{
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
gs_free_error GError *error = NULL;
gs_free char *filename = NULL;
gs_free char *data = NULL;
diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c
index 53217e6f33..290a9c3063 100644
--- a/clients/common/nm-secret-agent-simple.c
+++ b/clients/common/nm-secret-agent-simple.c
@@ -550,7 +550,7 @@ _auth_dialog_exited (GPid pid, int status, gpointer user_data)
RequestData *request = data->request;
GPtrArray *secrets = data->secrets;
NMSettingVpn *s_vpn = nm_connection_get_setting_vpn (request->connection);
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
gs_strfreev char **groups = NULL;
gs_free char *title = NULL;
gs_free char *message = NULL;
diff --git a/dispatcher/tests/test-dispatcher-envp.c b/dispatcher/tests/test-dispatcher-envp.c
index 240b89513f..528a0027c6 100644
--- a/dispatcher/tests/test-dispatcher-envp.c
+++ b/dispatcher/tests/test-dispatcher-envp.c
@@ -395,7 +395,7 @@ get_dispatcher_file (const char *file,
GHashTable **out_env,
GError **error)
{
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
gs_strfreev char **keys = NULL;
char **iter;
diff --git a/libnm-core/nm-keyfile/nm-keyfile.c b/libnm-core/nm-keyfile/nm-keyfile.c
index c1fcae3d28..a51d75ab6e 100644
--- a/libnm-core/nm-keyfile/nm-keyfile.c
+++ b/libnm-core/nm-keyfile/nm-keyfile.c
@@ -4093,7 +4093,7 @@ nm_keyfile_write (NMConnection *connection,
void *user_data,
GError **error)
{
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
KeyfileWriterInfo info;
gs_free NMSetting **settings = NULL;
guint i, j, n_settings = 0;
diff --git a/libnm-core/tests/test-keyfile.c b/libnm-core/tests/test-keyfile.c
index c9ec51f01b..ec289b7cd8 100644
--- a/libnm-core/tests/test-keyfile.c
+++ b/libnm-core/tests/test-keyfile.c
@@ -66,7 +66,7 @@ do_test_encode_key_full (GKeyFile *kf, const char *name, const char *key, const
static void
test_encode_key (void)
{
- gs_unref_keyfile GKeyFile *kf = g_key_file_new ();
+ nm_auto_unref_keyfile GKeyFile *kf = g_key_file_new ();
do_test_encode_key_identity (kf, "a");
do_test_encode_key_bijection (kf, "", "\\00");
@@ -209,7 +209,7 @@ _keyfile_convert (NMConnection **con,
NMConnection *c0;
GKeyFile *k0;
gs_unref_object NMConnection *c0_k1_c2 = NULL, *k0_c1 = NULL, *k0_c1_k2_c3 = NULL;
- gs_unref_keyfile GKeyFile *k0_c1_k2 = NULL, *c0_k1 = NULL, *c0_k1_c2_k3 = NULL;
+ nm_auto_unref_keyfile GKeyFile *k0_c1_k2 = NULL, *c0_k1 = NULL, *c0_k1_c2_k3 = NULL;
/* convert from @con to @keyfile and check that we can make
* full round trips and obtaining the same result. */
@@ -654,7 +654,7 @@ test_team_conf_read_invalid (void)
static void
test_user_1 (void)
{
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
gs_unref_object NMConnection *con = NULL;
NMSettingUser *s_user;
@@ -721,7 +721,7 @@ test_user_1 (void)
static void
test_vpn_1 (void)
{
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
gs_unref_object NMConnection *con = NULL;
NMSettingVpn *s_vpn;
@@ -748,7 +748,7 @@ test_vpn_1 (void)
static void
test_bridge_vlans (void)
{
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
gs_unref_object NMConnection *con = NULL;
NMSettingBridge *s_bridge;
NMBridgeVlan *vlan;
@@ -798,7 +798,7 @@ test_bridge_vlans (void)
static void
test_bridge_port_vlans (void)
{
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
gs_unref_object NMConnection *con = NULL;
NMSettingBridgePort *s_port;
NMBridgeVlan *vlan;
diff --git a/libnm-core/tests/test-setting.c b/libnm-core/tests/test-setting.c
index 6bf1fdb1e4..60da507ee7 100644
--- a/libnm-core/tests/test-setting.c
+++ b/libnm-core/tests/test-setting.c
@@ -1562,7 +1562,7 @@ test_ethtool_features (void)
gs_unref_object NMConnection *con3 = NULL;
gs_unref_variant GVariant *variant = NULL;
gs_free_error GError *error = NULL;
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
NMSettingConnection *s_con;
NMSettingEthtool *s_ethtool;
NMSettingEthtool *s_ethtool2;
@@ -1636,7 +1636,7 @@ test_ethtool_coalesce (void)
gs_unref_object NMConnection *con3 = NULL;
gs_unref_variant GVariant *variant = NULL;
gs_free_error GError *error = NULL;
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
NMSettingConnection *s_con;
NMSettingEthtool *s_ethtool;
NMSettingEthtool *s_ethtool2;
@@ -1721,7 +1721,7 @@ test_ethtool_ring (void)
gs_unref_object NMConnection *con3 = NULL;
gs_unref_variant GVariant *variant = NULL;
gs_free_error GError *error = NULL;
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
NMSettingConnection *s_con;
NMSettingEthtool *s_ethtool;
NMSettingEthtool *s_ethtool2;
@@ -3369,7 +3369,7 @@ test_roundtrip_conversion (gconstpointer test_data)
* when converting @con to keyfile. Write @con to keyfile and compare the expected result
* literally. */
{
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
kf = nm_keyfile_write (con, NM_KEYFILE_HANDLER_FLAGS_NONE, NULL, NULL, &error);
nmtst_assert_success (kf, error);
@@ -3464,7 +3464,7 @@ test_roundtrip_conversion (gconstpointer test_data)
nmtst_assert_connection_equals (con, nmtst_get_rand_bool (), con2, nmtst_get_rand_bool ());
{
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
kf = nm_keyfile_write (con2, NM_KEYFILE_HANDLER_FLAGS_NONE, NULL, NULL, &error);
nmtst_assert_success (kf, error);
@@ -3752,7 +3752,7 @@ test_empty_setting (void)
gs_unref_object NMConnection *con2 = NULL;
NMSettingBluetooth *s_bt;
NMSettingGsm *s_gsm;
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
gs_free_error GError *error = NULL;
con = nmtst_create_minimal_connection ("bt-empty-gsm", "dca3192a-f2dc-48eb-b806-d0ff788f122c", NM_SETTING_BLUETOOTH_SETTING_NAME, NULL);
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h
index 4078871461..60cf52c384 100644
--- a/shared/nm-glib-aux/nm-macros-internal.h
+++ b/shared/nm-glib-aux/nm-macros-internal.h
@@ -38,118 +38,58 @@
/*****************************************************************************/
-/**
- * gs_free:
- *
- * Call g_free() on a variable location when it goes out of scope.
- */
-#define gs_free nm_auto(gs_local_free)
-NM_AUTO_DEFINE_FCN_VOID0 (void *, gs_local_free, g_free);
-
-/**
- * gs_unref_object:
- *
- * Call g_object_unref() on a variable location when it goes out of
- * scope. Note that unlike g_object_unref(), the variable may be
- * %NULL.
- */
-#define gs_unref_object nm_auto(gs_local_obj_unref)
-NM_AUTO_DEFINE_FCN_VOID0 (GObject *, gs_local_obj_unref, g_object_unref);
+#include "nm-glib.h"
-/**
- * gs_unref_variant:
- *
- * Call g_variant_unref() on a variable location when it goes out of
- * scope. Note that unlike g_variant_unref(), the variable may be
- * %NULL.
- */
-#define gs_unref_variant nm_auto(gs_local_variant_unref)
-NM_AUTO_DEFINE_FCN0 (GVariant *, gs_local_variant_unref, g_variant_unref);
+/*****************************************************************************/
-/**
- * gs_unref_array:
- *
- * Call g_array_unref() on a variable location when it goes out of
- * scope. Note that unlike g_array_unref(), the variable may be
- * %NULL.
+#define nm_offsetofend(t,m) (G_STRUCT_OFFSET (t,m) + sizeof (((t *) NULL)->m))
- */
-#define gs_unref_array nm_auto(gs_local_array_unref)
-NM_AUTO_DEFINE_FCN0 (GArray *, gs_local_array_unref, g_array_unref);
+/*****************************************************************************/
-/**
- * gs_unref_ptrarray:
- *
- * Call g_ptr_array_unref() on a variable location when it goes out of
- * scope. Note that unlike g_ptr_array_unref(), the variable may be
- * %NULL.
+#define gs_free nm_auto_g_free
+#define gs_unref_object nm_auto_unref_object
+#define gs_unref_variant nm_auto_unref_variant
+#define gs_unref_array nm_auto_unref_array
+#define gs_unref_ptrarray nm_auto_unref_ptrarray
+#define gs_unref_hashtable nm_auto_unref_hashtable
+#define gs_unref_bytes nm_auto_unref_bytes
+#define gs_strfreev nm_auto_strfreev
+#define gs_free_error nm_auto_free_error
- */
-#define gs_unref_ptrarray nm_auto(gs_local_ptrarray_unref)
-NM_AUTO_DEFINE_FCN0 (GPtrArray *, gs_local_ptrarray_unref, g_ptr_array_unref);
+/*****************************************************************************/
-/**
- * gs_unref_hashtable:
- *
- * Call g_hash_table_unref() on a variable location when it goes out
- * of scope. Note that unlike g_hash_table_unref(), the variable may
- * be %NULL.
- */
-#define gs_unref_hashtable nm_auto(gs_local_hashtable_unref)
-NM_AUTO_DEFINE_FCN0 (GHashTable *, gs_local_hashtable_unref, g_hash_table_unref);
+NM_AUTO_DEFINE_FCN_VOID0 (void *, _nm_auto_g_free, g_free);
+#define nm_auto_g_free nm_auto(_nm_auto_g_free)
-/**
- * gs_free_slist:
- *
- * Call g_slist_free() on a variable location when it goes out
- * of scope.
- */
-#define gs_free_slist nm_auto(gs_local_free_slist)
-NM_AUTO_DEFINE_FCN0 (GSList *, gs_local_free_slist, g_slist_free);
+NM_AUTO_DEFINE_FCN_VOID0 (GObject *, _nm_auto_unref_object, g_object_unref);
+#define nm_auto_unref_object nm_auto(_nm_auto_unref_object)
-/**
- * gs_unref_bytes:
- *
- * Call g_bytes_unref() on a variable location when it goes out
- * of scope. Note that unlike g_bytes_unref(), the variable may
- * be %NULL.
- */
-#define gs_unref_bytes nm_auto(gs_local_bytes_unref)
-NM_AUTO_DEFINE_FCN0 (GBytes *, gs_local_bytes_unref, g_bytes_unref);
+NM_AUTO_DEFINE_FCN0 (GVariant *, _nm_auto_unref_variant, g_variant_unref);
+#define nm_auto_unref_variant nm_auto(_nm_auto_unref_variant)
-/**
- * gs_strfreev:
- *
- * Call g_strfreev() on a variable location when it goes out of scope.
- */
-#define gs_strfreev nm_auto(gs_local_strfreev)
-NM_AUTO_DEFINE_FCN0 (char **, gs_local_strfreev, g_strfreev);
+NM_AUTO_DEFINE_FCN0 (GArray *, _nm_auto_unref_array, g_array_unref);
+#define nm_auto_unref_array nm_auto(_nm_auto_unref_array)
-/**
- * gs_free_error:
- *
- * Call g_error_free() on a variable location when it goes out of scope.
- */
-#define gs_free_error nm_auto(gs_local_free_error)
-NM_AUTO_DEFINE_FCN0 (GError *, gs_local_free_error, g_error_free);
+NM_AUTO_DEFINE_FCN0 (GPtrArray *, _nm_auto_unref_ptrarray, g_ptr_array_unref);
+#define nm_auto_unref_ptrarray nm_auto(_nm_auto_unref_ptrarray)
-/**
- * gs_unref_keyfile:
- *
- * Call g_key_file_unref() on a variable location when it goes out of scope.
- */
-#define gs_unref_keyfile nm_auto(gs_local_keyfile_unref)
-NM_AUTO_DEFINE_FCN0 (GKeyFile *, gs_local_keyfile_unref, g_key_file_unref);
+NM_AUTO_DEFINE_FCN0 (GHashTable *, _nm_auto_unref_hashtable, g_hash_table_unref);
+#define nm_auto_unref_hashtable nm_auto(_nm_auto_unref_hashtable)
-/*****************************************************************************/
+NM_AUTO_DEFINE_FCN0 (GSList *, _nm_auto_free_slist, g_slist_free);
+#define nm_auto_free_slist nm_auto(_nm_auto_free_slist)
-#include "nm-glib.h"
+NM_AUTO_DEFINE_FCN0 (GBytes *, _nm_auto_unref_bytes, g_bytes_unref);
+#define nm_auto_unref_bytes nm_auto(_nm_auto_unref_bytes)
-/*****************************************************************************/
+NM_AUTO_DEFINE_FCN0 (char **, _nm_auto_strfreev, g_strfreev);
+#define nm_auto_strfreev nm_auto(_nm_auto_strfreev)
-#define nm_offsetofend(t,m) (G_STRUCT_OFFSET (t,m) + sizeof (((t *) NULL)->m))
+NM_AUTO_DEFINE_FCN0 (GError *, _nm_auto_free_error, g_error_free);
+#define nm_auto_free_error nm_auto(_nm_auto_free_error)
-/*****************************************************************************/
+NM_AUTO_DEFINE_FCN0 (GKeyFile *, _nm_auto_unref_keyfile, g_key_file_unref);
+#define nm_auto_unref_keyfile nm_auto(_nm_auto_unref_keyfile)
NM_AUTO_DEFINE_FCN0 (GVariantIter *, _nm_auto_free_variant_iter, g_variant_iter_free);
#define nm_auto_free_variant_iter nm_auto(_nm_auto_free_variant_iter)
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h
index 8247fbfc08..08ba9166c2 100644
--- a/shared/nm-utils/nm-test-utils.h
+++ b/shared/nm-utils/nm-test-utils.h
@@ -1973,7 +1973,7 @@ nmtst_assert_connection_equals (NMConnection *a, gboolean normalize_a, NMConnect
#ifdef __NM_KEYFILE_INTERNAL_H__
{
- gs_unref_keyfile GKeyFile *kf_a = NULL, *kf_b = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf_a = NULL, *kf_b = NULL;
gs_free char *str_a = NULL, *str_b = NULL;
kf_a = nm_keyfile_write (a, NM_KEYFILE_HANDLER_FLAGS_NONE, NULL, NULL, NULL);
@@ -2300,7 +2300,7 @@ nmtst_assert_hwaddr_equals (gconstpointer hwaddr1, gssize hwaddr1_len, const cha
static inline NMConnection *
nmtst_create_connection_from_keyfile (const char *keyfile_str, const char *full_filename)
{
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
gs_free_error GError *error = NULL;
gboolean success;
NMConnection *con;
@@ -2532,7 +2532,7 @@ nmtst_variant_from_string (const GVariantType *variant_type,
static inline void
nmtst_keyfile_assert_data (GKeyFile *kf, const char *data, gssize data_len)
{
- gs_unref_keyfile GKeyFile *kf2 = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf2 = NULL;
gs_free_error GError *error = NULL;
gs_free char *d1 = NULL;
gs_free char *d2 = NULL;
diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c
index d9f3280ecf..fdcbc283fd 100644
--- a/src/initrd/nm-initrd-generator.c
+++ b/src/initrd/nm-initrd-generator.c
@@ -25,7 +25,7 @@ output_conn (gpointer key, gpointer value, gpointer user_data)
const char *basename = key;
NMConnection *connection = value;
char *connections_dir = user_data;
- gs_unref_keyfile GKeyFile *file = NULL;
+ nm_auto_unref_keyfile GKeyFile *file = NULL;
gs_free char *data = NULL;
gs_free_error GError *error = NULL;
gsize len;
diff --git a/src/nm-config-data.c b/src/nm-config-data.c
index ea3aed470b..801a0065e5 100644
--- a/src/nm-config-data.c
+++ b/src/nm-config-data.c
@@ -219,7 +219,7 @@ nm_config_data_get_plugins (const NMConfigData *self, gboolean allow_default)
list = g_key_file_get_string_list (priv->keyfile, NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", NULL, &error);
if ( nm_keyfile_error_is_not_found (error)
&& allow_default) {
- gs_unref_keyfile GKeyFile *kf = nm_config_create_keyfile ();
+ nm_auto_unref_keyfile GKeyFile *kf = nm_config_create_keyfile ();
/* let keyfile split the default string according to its own escaping rules. */
g_key_file_set_value (kf, NM_CONFIG_KEYFILE_GROUP_MAIN, "plugins", NM_CONFIG_DEFAULT_MAIN_PLUGINS);
diff --git a/src/nm-config.c b/src/nm-config.c
index e0b9ce3ce7..66e8352eca 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -900,7 +900,7 @@ read_config (GKeyFile *keyfile,
GPtrArray *warnings,
GError **error)
{
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
gs_strfreev char **groups = NULL;
gs_free char *path_free = NULL;
gsize ngroups;
@@ -1020,8 +1020,8 @@ read_config (GKeyFile *keyfile,
} else {
gs_free char *old_sval = nm_config_keyfile_get_value (keyfile, group, base_key, NM_CONFIG_GET_VALUE_TYPE_SPEC);
gs_free char *new_sval = nm_config_keyfile_get_value (kf, group, key, NM_CONFIG_GET_VALUE_TYPE_SPEC);
- gs_free_slist GSList *old_specs = nm_match_spec_split (old_sval);
- gs_free_slist GSList *new_specs = nm_match_spec_split (new_sval);
+ nm_auto_free_slist GSList *old_specs = nm_match_spec_split (old_sval);
+ nm_auto_free_slist GSList *new_specs = nm_match_spec_split (new_sval);
/* the key is a device spec. This is a special kind of string-list, that
* we must split differently. */
@@ -1049,7 +1049,7 @@ read_config (GKeyFile *keyfile,
if (is_string_list)
nm_config_keyfile_set_string_list (keyfile, group, base_key, (const char *const*) new->pdata, new->len);
else {
- gs_free_slist GSList *specs = NULL;
+ nm_auto_free_slist GSList *specs = NULL;
gs_free char *specs_joined = NULL;
g_ptr_array_add (new, NULL);
@@ -1210,7 +1210,7 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
GPtrArray *warnings,
GError **error)
{
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
gs_unref_ptrarray GPtrArray *system_confs = NULL;
gs_unref_ptrarray GPtrArray *confs = NULL;
gs_unref_ptrarray GPtrArray *run_confs = NULL;
@@ -2310,7 +2310,7 @@ nm_config_device_state_load (int ifindex)
{
NMConfigDeviceStateData *device_state;
char path[NM_STRLEN (NM_CONFIG_DEVICE_STATE_DIR"/") + DEVICE_STATE_FILENAME_LEN_MAX + 1];
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
const char *nm_owned_str;
g_return_val_if_fail (ifindex > 0, NULL);
@@ -2397,7 +2397,7 @@ nm_config_device_state_write (int ifindex,
{
char path[NM_STRLEN (NM_CONFIG_DEVICE_STATE_DIR"/") + DEVICE_STATE_FILENAME_LEN_MAX + 1];
GError *local = NULL;
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (!connection_uuid || *connection_uuid, FALSE);
@@ -2782,8 +2782,8 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
{
NMConfig *self = NM_CONFIG (initable);
NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (self);
- gs_unref_keyfile GKeyFile *keyfile = NULL;
- gs_unref_keyfile GKeyFile *keyfile_intern = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile_intern = NULL;
gs_free char *config_main_file = NULL;
gs_free char *config_description = NULL;
gs_strfreev char **no_auto_default = NULL;
diff --git a/src/settings/plugins/keyfile/nms-keyfile-reader.c b/src/settings/plugins/keyfile/nms-keyfile-reader.c
index 0e9ad5fa48..bb6f90e63f 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-reader.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-reader.c
@@ -161,7 +161,7 @@ nms_keyfile_reader_from_file (const char *full_filename,
NMTernary *out_shadowed_owned,
GError **error)
{
- gs_unref_keyfile GKeyFile *key_file = NULL;
+ nm_auto_unref_keyfile GKeyFile *key_file = NULL;
NMConnection *connection = NULL;
GError *verify_error = NULL;
diff --git a/src/settings/plugins/keyfile/nms-keyfile-utils.c b/src/settings/plugins/keyfile/nms-keyfile-utils.c
index e3c3969146..f33653161e 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-utils.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-utils.c
@@ -127,7 +127,7 @@ nms_keyfile_nmmeta_read (const char *dirname,
return FALSE;
if (S_ISREG (st->st_mode)) {
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
gs_free char *v_uuid = NULL;
kf = g_key_file_new ();
@@ -243,7 +243,7 @@ nms_keyfile_nmmeta_write (const char *dirname,
full_filename = g_strndup (full_filename_tmp, strlen (full_filename_tmp) - 1);
if (shadowed_storage) {
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
gs_free char *contents = NULL;
gsize length;
diff --git a/src/settings/plugins/keyfile/nms-keyfile-writer.c b/src/settings/plugins/keyfile/nms-keyfile-writer.c
index feea606517..2676f5bfd8 100644
--- a/src/settings/plugins/keyfile/nms-keyfile-writer.c
+++ b/src/settings/plugins/keyfile/nms-keyfile-writer.c
@@ -185,7 +185,7 @@ _internal_write_connection (NMConnection *connection,
gboolean *out_reread_same,
GError **error)
{
- gs_unref_keyfile GKeyFile *kf_file = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf_file = NULL;
gs_free char *kf_content_buf = NULL;
gsize kf_content_len;
gs_free char *path = NULL;
diff --git a/src/settings/plugins/keyfile/tests/test-keyfile-settings.c b/src/settings/plugins/keyfile/tests/test-keyfile-settings.c
index 98820272c1..70b0735afd 100644
--- a/src/settings/plugins/keyfile/tests/test-keyfile-settings.c
+++ b/src/settings/plugins/keyfile/tests/test-keyfile-settings.c
@@ -802,7 +802,7 @@ test_write_string_ssid (void)
gs_free char *testfile = NULL;
GBytes *ssid;
unsigned char tmpssid[] = { 65, 49, 50, 51, 32, 46, 92, 46, 36, 37, 126, 93 };
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
connection = nm_simple_connection_new ();
@@ -880,7 +880,7 @@ test_write_intlist_ssid (void)
GBytes *ssid;
unsigned char tmpssid[] = { 65, 49, 50, 51, 0, 50, 50 };
gs_free_error GError *error = NULL;
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
int *intlist;
gsize len = 0, i;
@@ -979,7 +979,7 @@ test_write_intlike_ssid (void)
GBytes *ssid;
unsigned char tmpssid[] = { 49, 48, 49 };
gs_free_error GError *error = NULL;
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
char *tmp;
connection = nm_simple_connection_new ();
@@ -1037,7 +1037,7 @@ test_write_intlike_ssid_2 (void)
GBytes *ssid;
unsigned char tmpssid[] = { 49, 49, 59, 49, 50, 59, 49, 51, 59};
gs_free_error GError *error = NULL;
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
char *tmp;
connection = nm_simple_connection_new ();
@@ -1533,7 +1533,7 @@ test_write_wired_8021x_tls_connection_path (void)
char *tmp, *tmp2;
gboolean success;
gs_free char *testfile = NULL;
- gs_unref_keyfile GKeyFile *keyfile = NULL;
+ nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
gboolean relative = FALSE;
gboolean reread_same = FALSE;
@@ -1966,7 +1966,7 @@ test_write_new_wired_group_name (void)
{
NMTST_UUID_INIT (uuid);
gs_unref_object NMConnection *connection = NULL;
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
gs_free char *testfile = NULL;
@@ -2044,7 +2044,7 @@ test_write_new_wireless_group_names (void)
{
NMTST_UUID_INIT (uuid);
gs_unref_object NMConnection *connection = NULL;
- gs_unref_keyfile GKeyFile *kf = NULL;
+ nm_auto_unref_keyfile GKeyFile *kf = NULL;
NMSettingConnection *s_con;
NMSettingWireless *s_wifi;
NMSettingWirelessSecurity *s_wsec;
diff --git a/src/tests/test-core.c b/src/tests/test-core.c
index 792a4a57ab..03fd679f94 100644
--- a/src/tests/test-core.c
+++ b/src/tests/test-core.c
@@ -801,7 +801,7 @@ test_connection_match_ip4_routes1 (void)
{
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
NMConnection *matched;
- gs_free_slist GSList *connections = NULL;
+ nm_auto_free_slist GSList *connections = NULL;
NMSettingIPConfig *s_ip4;
orig = _match_connection_new ();
@@ -837,7 +837,7 @@ test_connection_match_ip4_routes2 (void)
{
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
NMConnection *matched;
- gs_free_slist GSList *connections = NULL;
+ nm_auto_free_slist GSList *connections = NULL;
NMSettingIPConfig *s_ip4;
orig = _match_connection_new ();
@@ -876,7 +876,7 @@ test_connection_match_ip6_routes (void)
{
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
NMConnection *matched;
- gs_free_slist GSList *connections = NULL;
+ nm_auto_free_slist GSList *connections = NULL;
NMSettingIPConfig *s_ip6;
orig = _match_connection_new ();