diff options
author | Ben Chan <benchan@chromium.org> | 2019-07-10 12:29:40 -0700 |
---|---|---|
committer | Ben Chan <benchan@chromium.org> | 2019-07-10 14:48:22 -0700 |
commit | 8d8b3a722aaeac5ba0e3b735b63e39bb007eee23 (patch) | |
tree | 0267ac6801403d4dd5f42f15e12788ea3d136b36 | |
parent | ea93aad8a414a3cdcf6864649e09e3bdf9ac4e5d (diff) |
misc: use g_regex_match() for simplicity
This CL converts a few g_regex_match_full() expressions to their
equivalent g_regex_match() in order to simplify the code, i.e.
g_regex_match_full (regex, str, strlen (str), 0, 0, &match_info, NULL)
is equivalent to:
g_regex_match_full (regex, str, -1, 0, 0, &match_info, NULL)
or simply:
g_regex_match (regex, str, 0, &match_info)
-rw-r--r-- | plugins/cinterion/mm-modem-helpers-cinterion.c | 4 | ||||
-rw-r--r-- | plugins/thuraya/mm-modem-helpers-thuraya.c | 2 | ||||
-rw-r--r-- | plugins/wavecom/mm-broadband-modem-wavecom.c | 2 | ||||
-rw-r--r-- | src/mm-broadband-modem.c | 2 | ||||
-rw-r--r-- | src/mm-modem-helpers.c | 16 |
5 files changed, 13 insertions, 13 deletions
diff --git a/plugins/cinterion/mm-modem-helpers-cinterion.c b/plugins/cinterion/mm-modem-helpers-cinterion.c index 2afd11a4..c7b0c44d 100644 --- a/plugins/cinterion/mm-modem-helpers-cinterion.c +++ b/plugins/cinterion/mm-modem-helpers-cinterion.c @@ -201,7 +201,7 @@ mm_cinterion_parse_scfg_response (const gchar *response, r = g_regex_new ("\\^SCFG:\\s*\"Radio/Band\",\\s*\"?([0-9a-fA-F]*)\"?", 0, 0, NULL); g_assert (r != NULL); - if (g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, NULL)) { + if (g_regex_match (r, response, 0, &match_info)) { gchar *currentstr; guint current = 0; @@ -441,7 +441,7 @@ mm_cinterion_parse_sind_response (const gchar *response, r = g_regex_new ("\\^SIND:\\s*(.*),(\\d+),(\\d+)(\\r\\n)?", 0, 0, NULL); g_assert (r != NULL); - if (g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, NULL)) { + if (g_regex_match (r, response, 0, &match_info)) { if (description) { *description = mm_get_string_unquoted_from_match_info (match_info, 1); if (*description == NULL) diff --git a/plugins/thuraya/mm-modem-helpers-thuraya.c b/plugins/thuraya/mm-modem-helpers-thuraya.c index b940e631..1dad59fd 100644 --- a/plugins/thuraya/mm-modem-helpers-thuraya.c +++ b/plugins/thuraya/mm-modem-helpers-thuraya.c @@ -99,7 +99,7 @@ mm_thuraya_3gpp_parse_cpms_test_response (const gchar *reply, array = g_array_new (FALSE, FALSE, sizeof (MMSmsStorage)); /* Got a range group to match */ - if (g_regex_match_full (r, splita[i], strlen (splita[i]), 0, 0, &match_info, NULL)) { + if (g_regex_match (r, splita[i], 0, &match_info)) { while (g_match_info_matches (match_info)) { gchar *str; diff --git a/plugins/wavecom/mm-broadband-modem-wavecom.c b/plugins/wavecom/mm-broadband-modem-wavecom.c index 51e50456..47980d86 100644 --- a/plugins/wavecom/mm-broadband-modem-wavecom.c +++ b/plugins/wavecom/mm-broadband-modem-wavecom.c @@ -261,7 +261,7 @@ wwsm_read_ready (MMBaseModem *self, r = g_regex_new ("\\r\\n\\+WWSM: ([0-2])(,([0-2]))?.*$", 0, 0, NULL); g_assert (r != NULL); - if (g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, NULL)) { + if (g_regex_match (r, response, 0, &match_info)) { guint allowed = 0; if (mm_get_uint_from_match_info (match_info, 1, &allowed)) { diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 07ce355f..2a21f4a7 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -6959,7 +6959,7 @@ sms_text_part_list_ready (MMBroadbandModem *self, 0, 0, NULL); g_assert (r); - if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, NULL)) { + if (!g_regex_match (r, response, 0, &match_info)) { g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index e1c9fc9d..5f027fdd 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -1880,7 +1880,7 @@ mm_3gpp_parse_cmgf_test_response (const gchar *reply, if (!r) return FALSE; - if (!g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, NULL)) { + if (!g_regex_match (r, reply, 0, &match_info)) { g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, @@ -1931,7 +1931,7 @@ mm_3gpp_parse_cmgr_read_response (const gchar *reply, r = g_regex_new ("\\+CMGR:\\s*(\\d+)\\s*,([^,]*),\\s*(\\d+)\\s*([^\\r\\n]*)", 0, 0, NULL); g_assert (r); - if (!g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, NULL)) { + if (!g_regex_match (r, reply, 0, &match_info)) { g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, @@ -2013,7 +2013,7 @@ mm_3gpp_parse_crsm_response (const gchar *reply, G_REGEX_RAW, 0, NULL); g_assert (r != NULL); - if (g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, NULL) && + if (g_regex_match (r, reply, 0, &match_info) && mm_get_uint_from_match_info (match_info, 1, sw1) && mm_get_uint_from_match_info (match_info, 2, sw2)) *hex = mm_get_string_unquoted_from_match_info (match_info, 3); @@ -2652,7 +2652,7 @@ mm_3gpp_parse_cpms_test_response (const gchar *reply, array = g_array_new (FALSE, FALSE, sizeof (MMSmsStorage)); /* Got a range group to match */ - if (g_regex_match_full (r, split[i], strlen (split[i]), 0, 0, &match_info, NULL)) { + if (g_regex_match (r, split[i], 0, &match_info)) { while (g_match_info_matches (match_info)) { gchar *str; @@ -2816,7 +2816,7 @@ mm_3gpp_parse_cscs_test_response (const gchar *reply, if (!r) return FALSE; - if (g_regex_match_full (r, p, strlen (p), 0, 0, &match_info, NULL)) { + if (g_regex_match (r, p, 0, &match_info)) { while (g_match_info_matches (match_info)) { str = g_match_info_fetch (match_info, 1); charsets |= mm_modem_charset_from_string (str); @@ -2858,7 +2858,7 @@ mm_3gpp_parse_clck_test_response (const gchar *reply, g_assert (r != NULL); *out_facilities = MM_MODEM_3GPP_FACILITY_NONE; - if (g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, NULL)) { + if (g_regex_match (r, reply, 0, &match_info)) { while (g_match_info_matches (match_info)) { gchar *str; @@ -3175,7 +3175,7 @@ mm_3gpp_parse_cind_test_response (const gchar *reply, hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) cind_response_free); - if (g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, NULL)) { + if (g_regex_match (r, reply, 0, &match_info)) { while (g_match_info_matches (match_info)) { MM3gppCindResponse *resp; gchar *desc, *tmp; @@ -3232,7 +3232,7 @@ mm_3gpp_parse_cind_read_response (const gchar *reply, r = g_regex_new ("(\\d+)[^0-9]+", G_REGEX_UNGREEDY, 0, NULL); g_assert (r != NULL); - if (!g_regex_match_full (r, reply, strlen (reply), 0, 0, &match_info, NULL)) { + if (!g_regex_match (r, reply, 0, &match_info)) { g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "Could not parse the +CIND response '%s': didn't match", reply); |