diff options
-rw-r--r-- | cli/mmcli-bearer.c | 7 | ||||
-rw-r--r-- | cli/mmcli-manager.c | 7 | ||||
-rw-r--r-- | cli/mmcli-modem.c | 7 |
3 files changed, 18 insertions, 3 deletions
diff --git a/cli/mmcli-bearer.c b/cli/mmcli-bearer.c index 5fe50fab..9330ea2c 100644 --- a/cli/mmcli-bearer.c +++ b/cli/mmcli-bearer.c @@ -83,7 +83,11 @@ mmcli_bearer_get_option_group (void) gboolean mmcli_bearer_options_enabled (void) { - guint n_actions; + static guint n_actions = 0; + static gboolean checked = FALSE; + + if (checked) + return !!n_actions; n_actions = (!!connect_with_number_str + connect_flag + @@ -103,6 +107,7 @@ mmcli_bearer_options_enabled (void) if (info_flag) mmcli_force_sync_operation (); + checked = TRUE; return !!n_actions; } diff --git a/cli/mmcli-manager.c b/cli/mmcli-manager.c index de6886fe..718a45be 100644 --- a/cli/mmcli-manager.c +++ b/cli/mmcli-manager.c @@ -86,7 +86,11 @@ mmcli_manager_get_option_group (void) gboolean mmcli_manager_options_enabled (void) { - guint n_actions; + static guint n_actions = 0; + static gboolean checked = FALSE; + + if (checked) + return !!n_actions; n_actions = (list_modems_flag + monitor_modems_flag + @@ -101,6 +105,7 @@ mmcli_manager_options_enabled (void) if (monitor_modems_flag) mmcli_force_async_operation (); + checked = TRUE; return !!n_actions; } diff --git a/cli/mmcli-modem.c b/cli/mmcli-modem.c index 8974f10f..2b4dfbc5 100644 --- a/cli/mmcli-modem.c +++ b/cli/mmcli-modem.c @@ -108,7 +108,11 @@ mmcli_modem_get_option_group (void) gboolean mmcli_modem_options_enabled (void) { - guint n_actions; + static guint n_actions = 0; + static gboolean checked = FALSE; + + if (checked) + return !!n_actions; n_actions = (monitor_state_flag + enable_flag + @@ -136,6 +140,7 @@ mmcli_modem_options_enabled (void) if (info_flag) mmcli_force_sync_operation (); + checked = TRUE; return !!n_actions; } |