all: use stack-allocated uuid at various places
No need to create a UUID on the heap in this case.
This commit is contained in:
@@ -602,17 +602,17 @@ static gboolean
|
||||
_normalize_connection_uuid (NMConnection *self)
|
||||
{
|
||||
NMSettingConnection *s_con = nm_connection_get_setting_connection (self);
|
||||
char *uuid;
|
||||
char uuid[37];
|
||||
|
||||
g_assert (s_con);
|
||||
nm_assert (s_con);
|
||||
|
||||
if (nm_setting_connection_get_uuid (s_con))
|
||||
return FALSE;
|
||||
|
||||
uuid = nm_utils_uuid_generate ();
|
||||
g_object_set (s_con, NM_SETTING_CONNECTION_UUID, uuid, NULL);
|
||||
g_free (uuid);
|
||||
|
||||
g_object_set (s_con,
|
||||
NM_SETTING_CONNECTION_UUID,
|
||||
nm_utils_uuid_generate_buf (uuid),
|
||||
NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -217,7 +217,7 @@ nm_utils_complete_generic (NMPlatform *platform,
|
||||
gboolean default_enable_ipv6)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
char *id, *uuid, *ifname;
|
||||
char *id, *ifname;
|
||||
GHashTable *parameters;
|
||||
|
||||
g_assert (fallback_id_prefix);
|
||||
@@ -230,9 +230,9 @@ nm_utils_complete_generic (NMPlatform *platform,
|
||||
g_object_set (G_OBJECT (s_con), NM_SETTING_CONNECTION_TYPE, ctype, NULL);
|
||||
|
||||
if (!nm_setting_connection_get_uuid (s_con)) {
|
||||
uuid = nm_utils_uuid_generate ();
|
||||
g_object_set (G_OBJECT (s_con), NM_SETTING_CONNECTION_UUID, uuid, NULL);
|
||||
g_free (uuid);
|
||||
char uuid[37];
|
||||
|
||||
g_object_set (G_OBJECT (s_con), NM_SETTING_CONNECTION_UUID, nm_utils_uuid_generate_buf (uuid), NULL);
|
||||
}
|
||||
|
||||
/* Add a connection ID if absent */
|
||||
|
@@ -183,7 +183,8 @@ pan_connection_check_create (NMBluezDevice *self)
|
||||
NMConnection *connection;
|
||||
NMConnection *added;
|
||||
NMSetting *setting;
|
||||
char *uuid, *id;
|
||||
char *id;
|
||||
char uuid[37];
|
||||
GError *error = NULL;
|
||||
NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
@@ -205,7 +206,7 @@ pan_connection_check_create (NMBluezDevice *self)
|
||||
connection = nm_simple_connection_new ();
|
||||
|
||||
/* Setting: Connection */
|
||||
uuid = nm_utils_uuid_generate ();
|
||||
nm_utils_uuid_generate_buf (uuid);
|
||||
id = g_strdup_printf (_("%s Network"), priv->name);
|
||||
setting = nm_setting_connection_new ();
|
||||
g_object_set (setting,
|
||||
@@ -266,7 +267,6 @@ pan_connection_check_create (NMBluezDevice *self)
|
||||
g_object_unref (connection);
|
||||
|
||||
g_free (id);
|
||||
g_free (uuid);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@@ -3629,7 +3629,7 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master)
|
||||
NMSetting *s_con;
|
||||
NMSetting *s_ip4;
|
||||
NMSetting *s_ip6;
|
||||
gs_free char *uuid = NULL;
|
||||
char uuid[37];
|
||||
const char *ip4_method, *ip6_method;
|
||||
GError *error = NULL;
|
||||
const NMPlatformLink *pllink;
|
||||
@@ -3646,10 +3646,9 @@ nm_device_generate_connection (NMDevice *self, NMDevice *master)
|
||||
|
||||
connection = nm_simple_connection_new ();
|
||||
s_con = nm_setting_connection_new ();
|
||||
uuid = nm_utils_uuid_generate ();
|
||||
|
||||
g_object_set (s_con,
|
||||
NM_SETTING_CONNECTION_UUID, uuid,
|
||||
NM_SETTING_CONNECTION_UUID, nm_utils_uuid_generate_buf (uuid),
|
||||
NM_SETTING_CONNECTION_ID, ifname,
|
||||
NM_SETTING_CONNECTION_AUTOCONNECT, FALSE,
|
||||
NM_SETTING_CONNECTION_INTERFACE_NAME, ifname,
|
||||
|
Reference in New Issue
Block a user