sim-qmi: rework Read Transparent processing to use g_autoptr()
This commit is contained in:
@@ -330,7 +330,7 @@ uim_get_iccid_ready (QmiClientUim *client,
|
|||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GArray *read_result;
|
g_autoptr(GArray) read_result = NULL;
|
||||||
g_autofree gchar *raw_iccid = NULL;
|
g_autofree gchar *raw_iccid = NULL;
|
||||||
gchar *iccid;
|
gchar *iccid;
|
||||||
|
|
||||||
@@ -344,14 +344,11 @@ uim_get_iccid_ready (QmiClientUim *client,
|
|||||||
raw_iccid = mm_utils_bin2hexstr ((const guint8 *) read_result->data, read_result->len);
|
raw_iccid = mm_utils_bin2hexstr ((const guint8 *) read_result->data, read_result->len);
|
||||||
g_assert (raw_iccid);
|
g_assert (raw_iccid);
|
||||||
iccid = mm_3gpp_parse_iccid (raw_iccid, &error);
|
iccid = mm_3gpp_parse_iccid (raw_iccid, &error);
|
||||||
if (!iccid) {
|
if (!iccid)
|
||||||
g_task_return_error (task, error);
|
g_task_return_error (task, error);
|
||||||
} else {
|
else
|
||||||
g_task_return_pointer (task, iccid, g_free);
|
g_task_return_pointer (task, iccid, g_free);
|
||||||
}
|
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
|
|
||||||
g_array_unref (read_result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -448,8 +445,8 @@ uim_get_imsi_ready (QmiClientUim *client,
|
|||||||
GTask *task)
|
GTask *task)
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GArray *read_result;
|
g_autoptr(GArray) read_result = NULL;
|
||||||
gchar *imsi;
|
g_autofree gchar *imsi = NULL;
|
||||||
|
|
||||||
read_result = uim_read_finish (client, res, &error);
|
read_result = uim_read_finish (client, res, &error);
|
||||||
if (!read_result) {
|
if (!read_result) {
|
||||||
@@ -473,9 +470,6 @@ uim_get_imsi_ready (QmiClientUim *client,
|
|||||||
* decimal digits to obtain the IMSI. */
|
* decimal digits to obtain the IMSI. */
|
||||||
g_task_return_pointer (task, g_strdup (imsi + 3), g_free);
|
g_task_return_pointer (task, g_strdup (imsi + 3), g_free);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
|
|
||||||
g_free (imsi);
|
|
||||||
g_array_unref (read_result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Reference in New Issue
Block a user