mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
all: replace cleanup macro "gs_unref_keyfile" by "nm_auto_unref_keyfile"
This commit is contained in:
parent
63f304ad58
commit
426a4c9d50
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -133,14 +133,6 @@ NM_AUTO_DEFINE_FCN0 (char **, gs_local_strfreev, g_strfreev);
|
|||
#define gs_free_error nm_auto(gs_local_free_error)
|
||||
NM_AUTO_DEFINE_FCN0 (GError *, gs_local_free_error, g_error_free);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "nm-glib.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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue