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.
This commit is contained in:
Aleksander Morgado
2016-02-13 14:33:12 +01:00
parent 95876c6f57
commit cffba7e0ee

View File

@@ -1343,8 +1343,8 @@ done:
} }
/*****************************************************************************/ /*****************************************************************************/
/* AT+CRSM response parser */ /* AT+CRSM response parser */
gboolean gboolean
mm_3gpp_parse_crsm_response (const gchar *reply, mm_3gpp_parse_crsm_response (const gchar *reply,
guint *sw1, 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]+)\"?", r = g_regex_new ("\\+CRSM:\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*\"?([0-9a-fA-F]+)\"?",
G_REGEX_RAW, 0, error); G_REGEX_RAW, 0, NULL);
if (!r) g_assert (r != NULL);
return FALSE;
if (g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, 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) && mm_get_uint_from_match_info (match_info, 1, sw1) &&