aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo Lobrano <c.lobrano@gmail.com>2022-08-11 10:34:17 +0200
committerCarlo Lobrano <c.lobrano@gmail.com>2022-09-29 07:03:37 +0000
commit3ab3d5e899d97fc459a22992359ab0db3c234e64 (patch)
treecb9a94760ac03615178395a84bc74159ec79f192
parenta55384d7b0053a3db07d5228f7e7fd85d7eeed2e (diff)
plugins,telit: refactor to reduce scope of variable
In mm_telit_build_bnd_request the scope of some 3g related variables can be reduced.
-rw-r--r--plugins/telit/mm-modem-helpers-telit.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/plugins/telit/mm-modem-helpers-telit.c b/plugins/telit/mm-modem-helpers-telit.c
index 5ee8bc6d..a0151c49 100644
--- a/plugins/telit/mm-modem-helpers-telit.c
+++ b/plugins/telit/mm-modem-helpers-telit.c
@@ -208,23 +208,10 @@ mm_telit_build_bnd_request (GArray *bands_array,
gint64 flag3g = -1;
gint64 flag4g = -1;
gchar *cmd;
- const guint64 *telit_3g_to_mm_band_mask;
- guint telit_3g_to_mm_band_mask_n_elements;
gboolean modem_is_2g = config->modem_is_2g;
gboolean modem_is_3g = config->modem_is_3g;
gboolean modem_is_4g = config->modem_is_4g;
- initialize_telit_3g_to_mm_band_masks ();
-
- /* Select correct 3G band mask */
- if (config->modem_alternate_3g_bands) {
- telit_3g_to_mm_band_mask = telit_3g_to_mm_band_mask_alternate;
- telit_3g_to_mm_band_mask_n_elements = G_N_ELEMENTS (telit_3g_to_mm_band_mask_alternate);
- } else {
- telit_3g_to_mm_band_mask = telit_3g_to_mm_band_mask_default;
- telit_3g_to_mm_band_mask_n_elements = G_N_ELEMENTS (telit_3g_to_mm_band_mask_default);
- }
-
for (i = 0; i < bands_array->len; i++) {
MMModemBand band;
@@ -272,6 +259,19 @@ mm_telit_build_bnd_request (GArray *bands_array,
/* Get 3G-specific telit value */
if (mask3g) {
+ const guint64 *telit_3g_to_mm_band_mask;
+ guint telit_3g_to_mm_band_mask_n_elements;
+
+ initialize_telit_3g_to_mm_band_masks ();
+
+ /* Select correct 3G band mask */
+ if (config->modem_alternate_3g_bands) {
+ telit_3g_to_mm_band_mask = telit_3g_to_mm_band_mask_alternate;
+ telit_3g_to_mm_band_mask_n_elements = G_N_ELEMENTS (telit_3g_to_mm_band_mask_alternate);
+ } else {
+ telit_3g_to_mm_band_mask = telit_3g_to_mm_band_mask_default;
+ telit_3g_to_mm_band_mask_n_elements = G_N_ELEMENTS (telit_3g_to_mm_band_mask_default);
+ }
for (i = 0; i < telit_3g_to_mm_band_mask_n_elements; i++) {
if (mask3g == telit_3g_to_mm_band_mask[i]) {
flag3g = i;