From cffba7e0ee512800329476d7da13046171c99067 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Sat, 13 Feb 2016 14:33:12 +0100 Subject: [PATCH] modem-helpers: regex creation should never fail We should really consider errors if we expect that the regex string may not compile; but in this case the pattern is fixed, so should never happen. --- src/mm-modem-helpers.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index ed365786..78932baf 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -1343,8 +1343,8 @@ done: } /*****************************************************************************/ - /* AT+CRSM response parser */ + gboolean mm_3gpp_parse_crsm_response (const gchar *reply, guint *sw1, @@ -1369,9 +1369,8 @@ mm_3gpp_parse_crsm_response (const gchar *reply, } r = g_regex_new ("\\+CRSM:\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*\"?([0-9a-fA-F]+)\"?", - G_REGEX_RAW, 0, error); - if (!r) - return FALSE; + G_REGEX_RAW, 0, NULL); + g_assert (r != NULL); if (g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, NULL) && mm_get_uint_from_match_info (match_info, 1, sw1) &&