ModemManager/backport-modem-helpers-cinterion-rework-CNMI-test-response-parser.patch
eaglegai 0919e84475 fix test failure because of glib2 switching to pcre2
(cherry picked from commit 53972dc64be14758edaa1c18f10463af5fcf7d9d)
2022-11-12 16:08:33 +08:00

67 lines
2.7 KiB
Diff

From e6c40349b81ac2915ce90b7e399eb33719a1fd24 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksandermj@chromium.org>
Date: Wed, 24 Aug 2022 16:42:45 +0000
Subject: [PATCH] modem-helpers-cinterion: rework CNMI test response parser
We setup all output variables with g_autoptr() and then use
g_steal_pointer() to return the needed ones.
---
.../cinterion/mm-modem-helpers-cinterion.c | 25 ++++++++-----------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/plugins/cinterion/mm-modem-helpers-cinterion.c b/plugins/cinterion/mm-modem-helpers-cinterion.c
index 0bf3a0782..9219bff4d 100644
--- a/plugins/cinterion/mm-modem-helpers-cinterion.c
+++ b/plugins/cinterion/mm-modem-helpers-cinterion.c
@@ -556,12 +556,12 @@ mm_cinterion_parse_cnmi_test (const gchar *response,
{
g_autoptr(GRegex) r = NULL;
g_autoptr(GMatchInfo) match_info = NULL;
+ g_autoptr(GArray) tmp_supported_mode = NULL;
+ g_autoptr(GArray) tmp_supported_mt = NULL;
+ g_autoptr(GArray) tmp_supported_bm = NULL;
+ g_autoptr(GArray) tmp_supported_ds = NULL;
+ g_autoptr(GArray) tmp_supported_bfr = NULL;
GError *inner_error = NULL;
- GArray *tmp_supported_mode = NULL;
- GArray *tmp_supported_mt = NULL;
- GArray *tmp_supported_bm = NULL;
- GArray *tmp_supported_ds = NULL;
- GArray *tmp_supported_bfr = NULL;
if (!response) {
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "Missing response");
@@ -619,25 +619,20 @@ mm_cinterion_parse_cnmi_test (const gchar *response,
out:
if (inner_error) {
- g_clear_pointer (&tmp_supported_mode, g_array_unref);
- g_clear_pointer (&tmp_supported_mt, g_array_unref);
- g_clear_pointer (&tmp_supported_bm, g_array_unref);
- g_clear_pointer (&tmp_supported_ds, g_array_unref);
- g_clear_pointer (&tmp_supported_bfr, g_array_unref);
g_propagate_error (error, inner_error);
return FALSE;
}
if (supported_mode)
- *supported_mode = tmp_supported_mode;
+ *supported_mode = g_steal_pointer (&tmp_supported_mode);
if (supported_mt)
- *supported_mt = tmp_supported_mt;
+ *supported_mt = g_steal_pointer (&tmp_supported_mt);
if (supported_bm)
- *supported_bm = tmp_supported_bm;
+ *supported_bm = g_steal_pointer (&tmp_supported_bm);
if (supported_ds)
- *supported_ds = tmp_supported_ds;
+ *supported_ds = g_steal_pointer (&tmp_supported_ds);
if (supported_bfr)
- *supported_bfr = tmp_supported_bfr;
+ *supported_bfr = g_steal_pointer (&tmp_supported_bfr);
return TRUE;
}
--
GitLab