wifi: use GBytes instead of GBytesArray for tracking blobs in supplicant

This commit is contained in:
Thomas Haller 2018-08-12 16:51:16 +02:00
parent 4607970288
commit dc316c8afe
2 changed files with 6 additions and 15 deletions

View file

@ -88,12 +88,6 @@ config_option_free (ConfigOption *opt)
g_slice_free (ConfigOption, opt);
}
static void
blob_free (GByteArray *array)
{
g_byte_array_free (array, TRUE);
}
static void
nm_supplicant_config_init (NMSupplicantConfig * self)
{
@ -105,7 +99,7 @@ nm_supplicant_config_init (NMSupplicantConfig * self)
priv->blobs = g_hash_table_new_full (nm_str_hash, g_str_equal,
(GDestroyNotify) g_free,
(GDestroyNotify) blob_free);
(GDestroyNotify) g_bytes_unref);
priv->ap_scan = 1;
priv->dispose_has_run = FALSE;
@ -198,7 +192,6 @@ nm_supplicant_config_add_blob (NMSupplicantConfig *self,
ConfigOption *old_opt;
ConfigOption *opt;
OptType type;
GByteArray *blob;
const guint8 *data;
gsize data_len;
@ -226,9 +219,6 @@ nm_supplicant_config_add_blob (NMSupplicantConfig *self,
return FALSE;
}
blob = g_byte_array_sized_new (data_len);
g_byte_array_append (blob, data, data_len);
opt = g_slice_new0 (ConfigOption);
opt->value = g_strdup_printf ("blob://%s", blobid);
opt->len = strlen (opt->value);
@ -237,7 +227,9 @@ nm_supplicant_config_add_blob (NMSupplicantConfig *self,
nm_log_info (LOGD_SUPPLICANT, "Config: added '%s' value '%s'", key, opt->value);
g_hash_table_insert (priv->config, g_strdup (key), opt);
g_hash_table_insert (priv->blobs, g_strdup (blobid), blob);
g_hash_table_insert (priv->blobs,
g_strdup (blobid),
g_bytes_ref (value));
return TRUE;
}

View file

@ -1579,7 +1579,7 @@ assoc_add_network_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_dat
GHashTable *blobs;
GHashTableIter iter;
const char *blob_name;
GByteArray *blob_data;
GBytes *blob_data;
assoc_data = add_network_data->assoc_data;
if (assoc_data)
@ -1637,8 +1637,7 @@ assoc_add_network_cb (GDBusProxy *proxy, GAsyncResult *result, gpointer user_dat
"AddBlob",
g_variant_new ("(s@ay)",
blob_name,
g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
blob_data->data, blob_data->len, 1)),
nm_utils_gbytes_to_variant_ay (blob_data)),
G_DBUS_CALL_FLAGS_NONE,
-1,
priv->assoc_data->cancellable,