[PATCH] osmocom-bb[master]: mobile: Use bool to show started can only be true or false

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Holger Freyther gerrit-no-reply at lists.osmocom.org
Sat Nov 18 12:51:34 UTC 2017


Review at  https://gerrit.osmocom.org/4908

mobile: Use bool to show started can only be true or false

The state handling is complicated and maybe it gets better by
moving started to bool and then the rest to an enum.

Change-Id: I6aef22e7bf954a8a4ecda980c2c558eb8c9180b7
---
M src/host/layer23/include/osmocom/bb/common/osmocom_data.h
M src/host/layer23/src/mobile/app_mobile.c
2 files changed, 5 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/08/4908/1

diff --git a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
index 9b544ab..21b2880 100644
--- a/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
+++ b/src/host/layer23/include/osmocom/bb/common/osmocom_data.h
@@ -62,7 +62,8 @@
 	uint16_t test_arfcn;
 	struct osmol1_entity l1_entity;
 
-	uint8_t deleting, shutdown, started;
+	bool started, deleting;
+	uint8_t shutdown;
 	struct gsm_support support;
 	struct gsm_settings settings;
 	struct gsm_subscriber subscr;
diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c
index 43631f3..1905010 100644
--- a/src/host/layer23/src/mobile/app_mobile.c
+++ b/src/host/layer23/src/mobile/app_mobile.c
@@ -131,7 +131,7 @@
 			gsm322_cs_sendmsg(ms, nmsg);
 		}
 
-		ms->started = 1;
+		ms->started = true;
 	}
 	return 0;
 }
@@ -231,7 +231,7 @@
 	gsm_random_imei(&ms->settings);
 
 	ms->shutdown = 0;
-	ms->started = 0;
+	ms->started = false;
 
 	if (!strcmp(ms->settings.imei, "000000000000000")) {
 		LOGP(DMOB, LOGL_NOTICE, "***\nWarning: Mobile '%s' has default IMEI: %s\n",
@@ -291,7 +291,7 @@
 {
 	int rc;
 
-	ms->deleting = 1;
+	ms->deleting = true;
 
 	if (mncc_recv_app) {
 		mncc_sock_exit(ms->mncc_entity.sock_state);

-- 
To view, visit https://gerrit.osmocom.org/4908
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6aef22e7bf954a8a4ecda980c2c558eb8c9180b7
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <holger at freyther.de>



More information about the gerrit-log mailing list