[Replicant] [libsamsung-ipc] [PATCH 19/26] tools: ipc-modem: get rid of call_done global variable

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Mon Mar 28 20:20:33 UTC 2022


Since we now have a private struct for all the data we need, we don't
need to use global variables anymore.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 tools/ipc-modem.c | 6 ++----
 tools/ipc-modem.h | 1 +
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/ipc-modem.c b/tools/ipc-modem.c
index ff0862b..8099972 100644
--- a/tools/ipc-modem.c
+++ b/tools/ipc-modem.c
@@ -46,8 +46,6 @@ enum log_target log_target;
 int state = MODEM_STATE_LPM;
 int seq;
 int out_call;
-int call_done;
-
 
 int seq_get(void)
 {
@@ -381,14 +379,14 @@ void modem_response_net(struct ipc_modem_data *data,
 			      "Registered with network! "
 			      "Got PLMN (Mobile Network Code): '%s'\n",
 			      mnc);
-		if (call_done == 0) {
+		if (data->call_done == 0) {
 			ipc_modem_log(data->client,
 				      MODEM_LOG_INFO,
 				      "Requesting outgoing call to %s!\n",
 				      data->call_number);
 			modem_exec_call_out(data->client, data->call_number);
 		}
-		call_done = 1;
+		data->call_done = 1;
 		break;
 	}
 }
diff --git a/tools/ipc-modem.h b/tools/ipc-modem.h
index 2a4849d..8a24d6f 100644
--- a/tools/ipc-modem.h
+++ b/tools/ipc-modem.h
@@ -50,6 +50,7 @@ struct ipc_modem_data {
 	bool debug;
 	bool dry_run;
 	/* State */
+	bool call_done;
 	bool in_call;
 };
 
-- 
2.35.1



More information about the Replicant mailing list