all: merge branch 'th/unify-nm-auto-macros'
This commit is contained in:
@@ -6322,7 +6322,7 @@ load_history_cmds (const char *uuid)
|
|||||||
static void
|
static void
|
||||||
save_history_cmds (const char *uuid)
|
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_error GError *error = NULL;
|
||||||
gs_free char *filename = NULL;
|
gs_free char *filename = NULL;
|
||||||
gs_free char *data = NULL;
|
gs_free char *data = NULL;
|
||||||
|
@@ -550,7 +550,7 @@ _auth_dialog_exited (GPid pid, int status, gpointer user_data)
|
|||||||
RequestData *request = data->request;
|
RequestData *request = data->request;
|
||||||
GPtrArray *secrets = data->secrets;
|
GPtrArray *secrets = data->secrets;
|
||||||
NMSettingVpn *s_vpn = nm_connection_get_setting_vpn (request->connection);
|
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_strfreev char **groups = NULL;
|
||||||
gs_free char *title = NULL;
|
gs_free char *title = NULL;
|
||||||
gs_free char *message = NULL;
|
gs_free char *message = NULL;
|
||||||
|
@@ -395,7 +395,7 @@ get_dispatcher_file (const char *file,
|
|||||||
GHashTable **out_env,
|
GHashTable **out_env,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gs_unref_keyfile GKeyFile *kf = NULL;
|
nm_auto_unref_keyfile GKeyFile *kf = NULL;
|
||||||
gs_strfreev char **keys = NULL;
|
gs_strfreev char **keys = NULL;
|
||||||
char **iter;
|
char **iter;
|
||||||
|
|
||||||
|
@@ -4093,7 +4093,7 @@ nm_keyfile_write (NMConnection *connection,
|
|||||||
void *user_data,
|
void *user_data,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
KeyfileWriterInfo info;
|
KeyfileWriterInfo info;
|
||||||
gs_free NMSetting **settings = NULL;
|
gs_free NMSetting **settings = NULL;
|
||||||
guint i, j, n_settings = 0;
|
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
|
static void
|
||||||
test_encode_key (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_identity (kf, "a");
|
||||||
do_test_encode_key_bijection (kf, "", "\\00");
|
do_test_encode_key_bijection (kf, "", "\\00");
|
||||||
@@ -209,7 +209,7 @@ _keyfile_convert (NMConnection **con,
|
|||||||
NMConnection *c0;
|
NMConnection *c0;
|
||||||
GKeyFile *k0;
|
GKeyFile *k0;
|
||||||
gs_unref_object NMConnection *c0_k1_c2 = NULL, *k0_c1 = NULL, *k0_c1_k2_c3 = NULL;
|
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
|
/* convert from @con to @keyfile and check that we can make
|
||||||
* full round trips and obtaining the same result. */
|
* full round trips and obtaining the same result. */
|
||||||
@@ -654,7 +654,7 @@ test_team_conf_read_invalid (void)
|
|||||||
static void
|
static void
|
||||||
test_user_1 (void)
|
test_user_1 (void)
|
||||||
{
|
{
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
gs_unref_object NMConnection *con = NULL;
|
gs_unref_object NMConnection *con = NULL;
|
||||||
NMSettingUser *s_user;
|
NMSettingUser *s_user;
|
||||||
|
|
||||||
@@ -721,7 +721,7 @@ test_user_1 (void)
|
|||||||
static void
|
static void
|
||||||
test_vpn_1 (void)
|
test_vpn_1 (void)
|
||||||
{
|
{
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
gs_unref_object NMConnection *con = NULL;
|
gs_unref_object NMConnection *con = NULL;
|
||||||
NMSettingVpn *s_vpn;
|
NMSettingVpn *s_vpn;
|
||||||
|
|
||||||
@@ -748,7 +748,7 @@ test_vpn_1 (void)
|
|||||||
static void
|
static void
|
||||||
test_bridge_vlans (void)
|
test_bridge_vlans (void)
|
||||||
{
|
{
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
gs_unref_object NMConnection *con = NULL;
|
gs_unref_object NMConnection *con = NULL;
|
||||||
NMSettingBridge *s_bridge;
|
NMSettingBridge *s_bridge;
|
||||||
NMBridgeVlan *vlan;
|
NMBridgeVlan *vlan;
|
||||||
@@ -798,7 +798,7 @@ test_bridge_vlans (void)
|
|||||||
static void
|
static void
|
||||||
test_bridge_port_vlans (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;
|
gs_unref_object NMConnection *con = NULL;
|
||||||
NMSettingBridgePort *s_port;
|
NMSettingBridgePort *s_port;
|
||||||
NMBridgeVlan *vlan;
|
NMBridgeVlan *vlan;
|
||||||
|
@@ -1562,7 +1562,7 @@ test_ethtool_features (void)
|
|||||||
gs_unref_object NMConnection *con3 = NULL;
|
gs_unref_object NMConnection *con3 = NULL;
|
||||||
gs_unref_variant GVariant *variant = NULL;
|
gs_unref_variant GVariant *variant = NULL;
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingEthtool *s_ethtool;
|
NMSettingEthtool *s_ethtool;
|
||||||
NMSettingEthtool *s_ethtool2;
|
NMSettingEthtool *s_ethtool2;
|
||||||
@@ -1636,7 +1636,7 @@ test_ethtool_coalesce (void)
|
|||||||
gs_unref_object NMConnection *con3 = NULL;
|
gs_unref_object NMConnection *con3 = NULL;
|
||||||
gs_unref_variant GVariant *variant = NULL;
|
gs_unref_variant GVariant *variant = NULL;
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingEthtool *s_ethtool;
|
NMSettingEthtool *s_ethtool;
|
||||||
NMSettingEthtool *s_ethtool2;
|
NMSettingEthtool *s_ethtool2;
|
||||||
@@ -1721,7 +1721,7 @@ test_ethtool_ring (void)
|
|||||||
gs_unref_object NMConnection *con3 = NULL;
|
gs_unref_object NMConnection *con3 = NULL;
|
||||||
gs_unref_variant GVariant *variant = NULL;
|
gs_unref_variant GVariant *variant = NULL;
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingEthtool *s_ethtool;
|
NMSettingEthtool *s_ethtool;
|
||||||
NMSettingEthtool *s_ethtool2;
|
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
|
* when converting @con to keyfile. Write @con to keyfile and compare the expected result
|
||||||
* literally. */
|
* 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);
|
kf = nm_keyfile_write (con, NM_KEYFILE_HANDLER_FLAGS_NONE, NULL, NULL, &error);
|
||||||
nmtst_assert_success (kf, 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 ());
|
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);
|
kf = nm_keyfile_write (con2, NM_KEYFILE_HANDLER_FLAGS_NONE, NULL, NULL, &error);
|
||||||
nmtst_assert_success (kf, error);
|
nmtst_assert_success (kf, error);
|
||||||
@@ -3752,7 +3752,7 @@ test_empty_setting (void)
|
|||||||
gs_unref_object NMConnection *con2 = NULL;
|
gs_unref_object NMConnection *con2 = NULL;
|
||||||
NMSettingBluetooth *s_bt;
|
NMSettingBluetooth *s_bt;
|
||||||
NMSettingGsm *s_gsm;
|
NMSettingGsm *s_gsm;
|
||||||
gs_unref_keyfile GKeyFile *kf = NULL;
|
nm_auto_unref_keyfile GKeyFile *kf = NULL;
|
||||||
gs_free_error GError *error = 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);
|
con = nmtst_create_minimal_connection ("bt-empty-gsm", "dca3192a-f2dc-48eb-b806-d0ff788f122c", NM_SETTING_BLUETOOTH_SETTING_NAME, NULL);
|
||||||
|
@@ -38,111 +38,6 @@
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 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_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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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"
|
#include "nm-glib.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -151,6 +46,51 @@ NM_AUTO_DEFINE_FCN0 (GKeyFile *, gs_local_keyfile_unref, g_key_file_unref);
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
NM_AUTO_DEFINE_FCN_VOID0 (void *, _nm_auto_g_free, g_free);
|
||||||
|
#define nm_auto_g_free nm_auto(_nm_auto_g_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)
|
||||||
|
|
||||||
|
NM_AUTO_DEFINE_FCN0 (GVariant *, _nm_auto_unref_variant, g_variant_unref);
|
||||||
|
#define nm_auto_unref_variant nm_auto(_nm_auto_unref_variant)
|
||||||
|
|
||||||
|
NM_AUTO_DEFINE_FCN0 (GArray *, _nm_auto_unref_array, g_array_unref);
|
||||||
|
#define nm_auto_unref_array nm_auto(_nm_auto_unref_array)
|
||||||
|
|
||||||
|
NM_AUTO_DEFINE_FCN0 (GPtrArray *, _nm_auto_unref_ptrarray, g_ptr_array_unref);
|
||||||
|
#define nm_auto_unref_ptrarray nm_auto(_nm_auto_unref_ptrarray)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
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);
|
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)
|
#define nm_auto_free_variant_iter nm_auto(_nm_auto_free_variant_iter)
|
||||||
|
|
||||||
|
@@ -1973,7 +1973,7 @@ nmtst_assert_connection_equals (NMConnection *a, gboolean normalize_a, NMConnect
|
|||||||
|
|
||||||
#ifdef __NM_KEYFILE_INTERNAL_H__
|
#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;
|
gs_free char *str_a = NULL, *str_b = NULL;
|
||||||
|
|
||||||
kf_a = nm_keyfile_write (a, NM_KEYFILE_HANDLER_FLAGS_NONE, NULL, NULL, 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 *
|
static inline NMConnection *
|
||||||
nmtst_create_connection_from_keyfile (const char *keyfile_str, const char *full_filename)
|
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;
|
gs_free_error GError *error = NULL;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
NMConnection *con;
|
NMConnection *con;
|
||||||
@@ -2532,7 +2532,7 @@ nmtst_variant_from_string (const GVariantType *variant_type,
|
|||||||
static inline void
|
static inline void
|
||||||
nmtst_keyfile_assert_data (GKeyFile *kf, const char *data, gssize data_len)
|
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_error GError *error = NULL;
|
||||||
gs_free char *d1 = NULL;
|
gs_free char *d1 = NULL;
|
||||||
gs_free char *d2 = NULL;
|
gs_free char *d2 = NULL;
|
||||||
|
@@ -25,7 +25,7 @@ output_conn (gpointer key, gpointer value, gpointer user_data)
|
|||||||
const char *basename = key;
|
const char *basename = key;
|
||||||
NMConnection *connection = value;
|
NMConnection *connection = value;
|
||||||
char *connections_dir = user_data;
|
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 char *data = NULL;
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
gsize len;
|
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);
|
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)
|
if ( nm_keyfile_error_is_not_found (error)
|
||||||
&& allow_default) {
|
&& 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. */
|
/* 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);
|
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,
|
GPtrArray *warnings,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gs_unref_keyfile GKeyFile *kf = NULL;
|
nm_auto_unref_keyfile GKeyFile *kf = NULL;
|
||||||
gs_strfreev char **groups = NULL;
|
gs_strfreev char **groups = NULL;
|
||||||
gs_free char *path_free = NULL;
|
gs_free char *path_free = NULL;
|
||||||
gsize ngroups;
|
gsize ngroups;
|
||||||
@@ -1020,8 +1020,8 @@ read_config (GKeyFile *keyfile,
|
|||||||
} else {
|
} else {
|
||||||
gs_free char *old_sval = nm_config_keyfile_get_value (keyfile, group, base_key, NM_CONFIG_GET_VALUE_TYPE_SPEC);
|
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 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);
|
nm_auto_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 *new_specs = nm_match_spec_split (new_sval);
|
||||||
|
|
||||||
/* the key is a device spec. This is a special kind of string-list, that
|
/* the key is a device spec. This is a special kind of string-list, that
|
||||||
* we must split differently. */
|
* we must split differently. */
|
||||||
@@ -1049,7 +1049,7 @@ read_config (GKeyFile *keyfile,
|
|||||||
if (is_string_list)
|
if (is_string_list)
|
||||||
nm_config_keyfile_set_string_list (keyfile, group, base_key, (const char *const*) new->pdata, new->len);
|
nm_config_keyfile_set_string_list (keyfile, group, base_key, (const char *const*) new->pdata, new->len);
|
||||||
else {
|
else {
|
||||||
gs_free_slist GSList *specs = NULL;
|
nm_auto_free_slist GSList *specs = NULL;
|
||||||
gs_free char *specs_joined = NULL;
|
gs_free char *specs_joined = NULL;
|
||||||
|
|
||||||
g_ptr_array_add (new, NULL);
|
g_ptr_array_add (new, NULL);
|
||||||
@@ -1210,7 +1210,7 @@ read_entire_config (const NMConfigCmdLineOptions *cli,
|
|||||||
GPtrArray *warnings,
|
GPtrArray *warnings,
|
||||||
GError **error)
|
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 *system_confs = NULL;
|
||||||
gs_unref_ptrarray GPtrArray *confs = NULL;
|
gs_unref_ptrarray GPtrArray *confs = NULL;
|
||||||
gs_unref_ptrarray GPtrArray *run_confs = NULL;
|
gs_unref_ptrarray GPtrArray *run_confs = NULL;
|
||||||
@@ -2310,7 +2310,7 @@ nm_config_device_state_load (int ifindex)
|
|||||||
{
|
{
|
||||||
NMConfigDeviceStateData *device_state;
|
NMConfigDeviceStateData *device_state;
|
||||||
char path[NM_STRLEN (NM_CONFIG_DEVICE_STATE_DIR"/") + DEVICE_STATE_FILENAME_LEN_MAX + 1];
|
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;
|
const char *nm_owned_str;
|
||||||
|
|
||||||
g_return_val_if_fail (ifindex > 0, NULL);
|
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];
|
char path[NM_STRLEN (NM_CONFIG_DEVICE_STATE_DIR"/") + DEVICE_STATE_FILENAME_LEN_MAX + 1];
|
||||||
GError *local = NULL;
|
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 (ifindex > 0, FALSE);
|
||||||
g_return_val_if_fail (!connection_uuid || *connection_uuid, 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);
|
NMConfig *self = NM_CONFIG (initable);
|
||||||
NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (self);
|
NMConfigPrivate *priv = NM_CONFIG_GET_PRIVATE (self);
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
gs_unref_keyfile GKeyFile *keyfile_intern = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile_intern = NULL;
|
||||||
gs_free char *config_main_file = NULL;
|
gs_free char *config_main_file = NULL;
|
||||||
gs_free char *config_description = NULL;
|
gs_free char *config_description = NULL;
|
||||||
gs_strfreev char **no_auto_default = 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,
|
NMTernary *out_shadowed_owned,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gs_unref_keyfile GKeyFile *key_file = NULL;
|
nm_auto_unref_keyfile GKeyFile *key_file = NULL;
|
||||||
NMConnection *connection = NULL;
|
NMConnection *connection = NULL;
|
||||||
GError *verify_error = NULL;
|
GError *verify_error = NULL;
|
||||||
|
|
||||||
|
@@ -127,7 +127,7 @@ nms_keyfile_nmmeta_read (const char *dirname,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (S_ISREG (st->st_mode)) {
|
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;
|
gs_free char *v_uuid = NULL;
|
||||||
|
|
||||||
kf = g_key_file_new ();
|
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);
|
full_filename = g_strndup (full_filename_tmp, strlen (full_filename_tmp) - 1);
|
||||||
|
|
||||||
if (shadowed_storage) {
|
if (shadowed_storage) {
|
||||||
gs_unref_keyfile GKeyFile *kf = NULL;
|
nm_auto_unref_keyfile GKeyFile *kf = NULL;
|
||||||
gs_free char *contents = NULL;
|
gs_free char *contents = NULL;
|
||||||
gsize length;
|
gsize length;
|
||||||
|
|
||||||
|
@@ -185,7 +185,7 @@ _internal_write_connection (NMConnection *connection,
|
|||||||
gboolean *out_reread_same,
|
gboolean *out_reread_same,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gs_unref_keyfile GKeyFile *kf_file = NULL;
|
nm_auto_unref_keyfile GKeyFile *kf_file = NULL;
|
||||||
gs_free char *kf_content_buf = NULL;
|
gs_free char *kf_content_buf = NULL;
|
||||||
gsize kf_content_len;
|
gsize kf_content_len;
|
||||||
gs_free char *path = NULL;
|
gs_free char *path = NULL;
|
||||||
|
@@ -802,7 +802,7 @@ test_write_string_ssid (void)
|
|||||||
gs_free char *testfile = NULL;
|
gs_free char *testfile = NULL;
|
||||||
GBytes *ssid;
|
GBytes *ssid;
|
||||||
unsigned char tmpssid[] = { 65, 49, 50, 51, 32, 46, 92, 46, 36, 37, 126, 93 };
|
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 ();
|
connection = nm_simple_connection_new ();
|
||||||
|
|
||||||
@@ -880,7 +880,7 @@ test_write_intlist_ssid (void)
|
|||||||
GBytes *ssid;
|
GBytes *ssid;
|
||||||
unsigned char tmpssid[] = { 65, 49, 50, 51, 0, 50, 50 };
|
unsigned char tmpssid[] = { 65, 49, 50, 51, 0, 50, 50 };
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
int *intlist;
|
int *intlist;
|
||||||
gsize len = 0, i;
|
gsize len = 0, i;
|
||||||
|
|
||||||
@@ -979,7 +979,7 @@ test_write_intlike_ssid (void)
|
|||||||
GBytes *ssid;
|
GBytes *ssid;
|
||||||
unsigned char tmpssid[] = { 49, 48, 49 };
|
unsigned char tmpssid[] = { 49, 48, 49 };
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
connection = nm_simple_connection_new ();
|
connection = nm_simple_connection_new ();
|
||||||
@@ -1037,7 +1037,7 @@ test_write_intlike_ssid_2 (void)
|
|||||||
GBytes *ssid;
|
GBytes *ssid;
|
||||||
unsigned char tmpssid[] = { 49, 49, 59, 49, 50, 59, 49, 51, 59};
|
unsigned char tmpssid[] = { 49, 49, 59, 49, 50, 59, 49, 51, 59};
|
||||||
gs_free_error GError *error = NULL;
|
gs_free_error GError *error = NULL;
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
connection = nm_simple_connection_new ();
|
connection = nm_simple_connection_new ();
|
||||||
@@ -1533,7 +1533,7 @@ test_write_wired_8021x_tls_connection_path (void)
|
|||||||
char *tmp, *tmp2;
|
char *tmp, *tmp2;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
gs_free char *testfile = NULL;
|
gs_free char *testfile = NULL;
|
||||||
gs_unref_keyfile GKeyFile *keyfile = NULL;
|
nm_auto_unref_keyfile GKeyFile *keyfile = NULL;
|
||||||
gboolean relative = FALSE;
|
gboolean relative = FALSE;
|
||||||
gboolean reread_same = FALSE;
|
gboolean reread_same = FALSE;
|
||||||
|
|
||||||
@@ -1966,7 +1966,7 @@ test_write_new_wired_group_name (void)
|
|||||||
{
|
{
|
||||||
NMTST_UUID_INIT (uuid);
|
NMTST_UUID_INIT (uuid);
|
||||||
gs_unref_object NMConnection *connection = NULL;
|
gs_unref_object NMConnection *connection = NULL;
|
||||||
gs_unref_keyfile GKeyFile *kf = NULL;
|
nm_auto_unref_keyfile GKeyFile *kf = NULL;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingWired *s_wired;
|
NMSettingWired *s_wired;
|
||||||
gs_free char *testfile = NULL;
|
gs_free char *testfile = NULL;
|
||||||
@@ -2044,7 +2044,7 @@ test_write_new_wireless_group_names (void)
|
|||||||
{
|
{
|
||||||
NMTST_UUID_INIT (uuid);
|
NMTST_UUID_INIT (uuid);
|
||||||
gs_unref_object NMConnection *connection = NULL;
|
gs_unref_object NMConnection *connection = NULL;
|
||||||
gs_unref_keyfile GKeyFile *kf = NULL;
|
nm_auto_unref_keyfile GKeyFile *kf = NULL;
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
NMSettingWireless *s_wifi;
|
NMSettingWireless *s_wifi;
|
||||||
NMSettingWirelessSecurity *s_wsec;
|
NMSettingWirelessSecurity *s_wsec;
|
||||||
|
@@ -801,7 +801,7 @@ test_connection_match_ip4_routes1 (void)
|
|||||||
{
|
{
|
||||||
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
|
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
|
||||||
NMConnection *matched;
|
NMConnection *matched;
|
||||||
gs_free_slist GSList *connections = NULL;
|
nm_auto_free_slist GSList *connections = NULL;
|
||||||
NMSettingIPConfig *s_ip4;
|
NMSettingIPConfig *s_ip4;
|
||||||
|
|
||||||
orig = _match_connection_new ();
|
orig = _match_connection_new ();
|
||||||
@@ -837,7 +837,7 @@ test_connection_match_ip4_routes2 (void)
|
|||||||
{
|
{
|
||||||
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
|
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
|
||||||
NMConnection *matched;
|
NMConnection *matched;
|
||||||
gs_free_slist GSList *connections = NULL;
|
nm_auto_free_slist GSList *connections = NULL;
|
||||||
NMSettingIPConfig *s_ip4;
|
NMSettingIPConfig *s_ip4;
|
||||||
|
|
||||||
orig = _match_connection_new ();
|
orig = _match_connection_new ();
|
||||||
@@ -876,7 +876,7 @@ test_connection_match_ip6_routes (void)
|
|||||||
{
|
{
|
||||||
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
|
gs_unref_object NMConnection *orig = NULL, *copy = NULL;
|
||||||
NMConnection *matched;
|
NMConnection *matched;
|
||||||
gs_free_slist GSList *connections = NULL;
|
nm_auto_free_slist GSList *connections = NULL;
|
||||||
NMSettingIPConfig *s_ip6;
|
NMSettingIPConfig *s_ip6;
|
||||||
|
|
||||||
orig = _match_connection_new ();
|
orig = _match_connection_new ();
|
||||||
|
Reference in New Issue
Block a user