diff options
author | Ben Chan <benchan@chromium.org> | 2018-10-17 23:06:48 -0700 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2018-10-18 13:17:36 +0200 |
commit | 7de6b6f2e176ed60f1f74d0d8704f73e39585891 (patch) | |
tree | e7a8e4adb2c7b6cd9da12be4c281440f6a796bc6 | |
parent | 749b806c30b41512dec4901808976425cdf3e56b (diff) | |
download | ModemManager-7de6b6f2e176ed60f1f74d0d8704f73e39585891.tar.gz |
core: remove unnecessary NULL checks for g_match_info_free()
g_match_info_free() already check if the given pointer is NULL and does
nothing on a NULL pointer.
-rw-r--r-- | plugins/cinterion/mm-modem-helpers-cinterion.c | 12 | ||||
-rw-r--r-- | plugins/huawei/mm-modem-helpers-huawei.c | 21 | ||||
-rw-r--r-- | plugins/mbm/mm-modem-helpers-mbm.c | 3 | ||||
-rw-r--r-- | plugins/mtk/mm-broadband-modem-mtk.c | 13 | ||||
-rw-r--r-- | plugins/novatel/mm-broadband-modem-novatel.c | 3 | ||||
-rw-r--r-- | plugins/sierra/mm-broadband-modem-sierra.c | 6 | ||||
-rw-r--r-- | plugins/sierra/mm-modem-helpers-sierra.c | 3 | ||||
-rw-r--r-- | plugins/ublox/mm-modem-helpers-ublox.c | 24 | ||||
-rw-r--r-- | plugins/wavecom/mm-broadband-modem-wavecom.c | 3 | ||||
-rw-r--r-- | plugins/xmm/mm-modem-helpers-xmm.c | 10 | ||||
-rw-r--r-- | plugins/zte/mm-broadband-modem-zte.c | 3 | ||||
-rw-r--r-- | src/mm-modem-helpers.c | 24 |
12 files changed, 40 insertions, 85 deletions
diff --git a/plugins/cinterion/mm-modem-helpers-cinterion.c b/plugins/cinterion/mm-modem-helpers-cinterion.c index 86cea6c1c..2afd11a41 100644 --- a/plugins/cinterion/mm-modem-helpers-cinterion.c +++ b/plugins/cinterion/mm-modem-helpers-cinterion.c @@ -147,8 +147,7 @@ mm_cinterion_parse_scfg_test (const gchar *response, g_free (maxbandstr); } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (!bands) @@ -234,8 +233,7 @@ mm_cinterion_parse_scfg_response (const gchar *response, g_free (currentstr); } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (!bands) @@ -341,8 +339,7 @@ mm_cinterion_parse_cnmi_test (const gchar *response, out: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -457,8 +454,7 @@ mm_cinterion_parse_sind_response (const gchar *response, } else errors++; - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (errors > 0) { diff --git a/plugins/huawei/mm-modem-helpers-huawei.c b/plugins/huawei/mm-modem-helpers-huawei.c index 2aac3d609..70de4f54f 100644 --- a/plugins/huawei/mm-modem-helpers-huawei.c +++ b/plugins/huawei/mm-modem-helpers-huawei.c @@ -257,8 +257,7 @@ mm_huawei_parse_dhcp_response (const char *reply, } } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return matched; } @@ -324,8 +323,7 @@ mm_huawei_parse_sysinfo_response (const char *reply, } } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return matched; } @@ -389,8 +387,7 @@ mm_huawei_parse_sysinfoex_response (const char *reply, mm_get_uint_from_match_info (match_info, 8, out_sys_submode); } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return matched; } @@ -1257,8 +1254,7 @@ gboolean mm_huawei_parse_nwtime_response (const gchar *response, } } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return ret; @@ -1329,8 +1325,7 @@ gboolean mm_huawei_parse_time_response (const gchar *response, } } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return ret; @@ -1400,8 +1395,7 @@ mm_huawei_parse_hcsq_response (const gchar *response, ret = TRUE; done: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return ret; @@ -1463,8 +1457,7 @@ mm_huawei_parse_cvoice_response (const gchar *response, } } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return ret; diff --git a/plugins/mbm/mm-modem-helpers-mbm.c b/plugins/mbm/mm-modem-helpers-mbm.c index ca024ddb6..18656e57e 100644 --- a/plugins/mbm/mm-modem-helpers-mbm.c +++ b/plugins/mbm/mm-modem-helpers-mbm.c @@ -159,8 +159,7 @@ mm_mbm_parse_e2ipcfg_response (const gchar *response, } done: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return !!*ip_config; } diff --git a/plugins/mtk/mm-broadband-modem-mtk.c b/plugins/mtk/mm-broadband-modem-mtk.c index 475a63ac3..0f8aaf799 100644 --- a/plugins/mtk/mm-broadband-modem-mtk.c +++ b/plugins/mtk/mm-broadband-modem-mtk.c @@ -122,8 +122,7 @@ load_unlock_retries_ready (MMBaseModem *self, } g_object_unref (task); - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); } @@ -224,8 +223,7 @@ get_supported_modes_ready (MMBaseModem *self, response); g_regex_unref (r); - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); return; } @@ -280,9 +278,7 @@ get_supported_modes_ready (MMBaseModem *self, g_object_unref (task); g_regex_unref (r); - if (match_info) - g_match_info_free (match_info); - return; + g_match_info_free (match_info); } static void @@ -412,8 +408,7 @@ load_current_modes_finish (MMIfaceModem *self, done: if (r) g_regex_unref (r); - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); return result; } diff --git a/plugins/novatel/mm-broadband-modem-novatel.c b/plugins/novatel/mm-broadband-modem-novatel.c index fdb4ba52a..676d2c876 100644 --- a/plugins/novatel/mm-broadband-modem-novatel.c +++ b/plugins/novatel/mm-broadband-modem-novatel.c @@ -1158,8 +1158,7 @@ parse_nwltime_reply (const char *response, else g_free (result); - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return success; } diff --git a/plugins/sierra/mm-broadband-modem-sierra.c b/plugins/sierra/mm-broadband-modem-sierra.c index 7a99a9bf8..21173c9ac 100644 --- a/plugins/sierra/mm-broadband-modem-sierra.c +++ b/plugins/sierra/mm-broadband-modem-sierra.c @@ -727,8 +727,7 @@ selrat_query_ready (MMBaseModem *self, "Could not parse allowed mode response: Response didn't match: '%s'", response); - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (error) { @@ -1382,8 +1381,7 @@ parse_time (const gchar *response, } } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return result; } diff --git a/plugins/sierra/mm-modem-helpers-sierra.c b/plugins/sierra/mm-modem-helpers-sierra.c index 14324614f..2d5fd7da6 100644 --- a/plugins/sierra/mm-modem-helpers-sierra.c +++ b/plugins/sierra/mm-modem-helpers-sierra.c @@ -67,8 +67,7 @@ mm_sierra_parse_scact_read_response (const gchar *reply, g_match_info_next (match_info, &inner_error); } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { diff --git a/plugins/ublox/mm-modem-helpers-ublox.c b/plugins/ublox/mm-modem-helpers-ublox.c index ff1a84885..b6fd34d98 100644 --- a/plugins/ublox/mm-modem-helpers-ublox.c +++ b/plugins/ublox/mm-modem-helpers-ublox.c @@ -78,8 +78,7 @@ mm_ublox_parse_upincnt_response (const gchar *response, out: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -144,8 +143,7 @@ mm_ublox_parse_uusbconf_response (const gchar *response, g_free (profile_name); } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -205,8 +203,7 @@ mm_ublox_parse_ubmconf_response (const gchar *response, } } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -292,8 +289,7 @@ mm_ublox_parse_uipaddr_response (const gchar *response, out: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -982,8 +978,7 @@ mm_ublox_parse_uact_response (const gchar *response, g_free (bandstr); } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -1097,8 +1092,7 @@ mm_ublox_parse_uact_test (const gchar *response, out: g_strfreev (split); - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -1229,8 +1223,7 @@ out: g_free (allowed_str); g_free (preferred_str); - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -1449,8 +1442,7 @@ mm_ublox_parse_ugcntrd_response_for_cid (const gchar *response, out: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { diff --git a/plugins/wavecom/mm-broadband-modem-wavecom.c b/plugins/wavecom/mm-broadband-modem-wavecom.c index 5da6c232a..51e504566 100644 --- a/plugins/wavecom/mm-broadband-modem-wavecom.c +++ b/plugins/wavecom/mm-broadband-modem-wavecom.c @@ -317,8 +317,7 @@ wwsm_read_ready (MMBaseModem *self, g_object_unref (task); g_regex_unref (r); - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); } static void diff --git a/plugins/xmm/mm-modem-helpers-xmm.c b/plugins/xmm/mm-modem-helpers-xmm.c index a3eb5f9b6..4ccbc7458 100644 --- a/plugins/xmm/mm-modem-helpers-xmm.c +++ b/plugins/xmm/mm-modem-helpers-xmm.c @@ -449,8 +449,7 @@ mm_xmm_parse_xact_query_response (const gchar *response, /* success */ out: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -672,9 +671,7 @@ mm_xmm_parse_xcesq_query_response (const gchar *response, } out: - - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -996,8 +993,7 @@ mm_xmm_parse_xlcsslp_query_response (const gchar *response, } out: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { diff --git a/plugins/zte/mm-broadband-modem-zte.c b/plugins/zte/mm-broadband-modem-zte.c index 575e7896f..a1b24bc30 100644 --- a/plugins/zte/mm-broadband-modem-zte.c +++ b/plugins/zte/mm-broadband-modem-zte.c @@ -405,8 +405,7 @@ load_current_modes_finish (MMIfaceModem *self, g_assert_not_reached (); done: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); if (r) g_regex_unref (r); diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 296b9f3a0..7845edcff 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -1303,8 +1303,7 @@ mm_3gpp_parse_cops_read_response (const gchar *response, } out: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -1608,8 +1607,7 @@ mm_3gpp_parse_cgact_read_response (const gchar *reply, g_match_info_next (match_info, &inner_error); } - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -2152,9 +2150,7 @@ mm_3gpp_parse_cgcontrdp_response (const gchar *response, dns_secondary_address = mm_get_string_unquoted_from_match_info (match_info, 7 + field_format_extra_index); out: - - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); g_free (local_address_and_subnet); @@ -2238,8 +2234,7 @@ mm_3gpp_parse_cfun_query_response (const gchar *response, *out_state = state; out: - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -2317,9 +2312,7 @@ mm_3gpp_parse_cesq_response (const gchar *response, } out: - - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); if (inner_error) { @@ -2725,8 +2718,7 @@ end: if (r != NULL) g_regex_unref (r); - if (match_info != NULL) - g_match_info_free (match_info); + g_match_info_free (match_info); return ret; } @@ -4321,9 +4313,7 @@ mm_parse_cclk_response (const char *response, ret = TRUE; out: - - if (match_info) - g_match_info_free (match_info); + g_match_info_free (match_info); g_regex_unref (r); return ret; |