Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11458 )

Change subject: msc_vlr_tests: tweak conn_exists()
......................................................................

msc_vlr_tests: tweak conn_exists()

* constify function parameter
* internalize parameter check

Change-Id: Icf507d094319123c6667ba963db1d385df4d4f92
---
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
2 files changed, 10 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/msc_vlr/msc_vlr_tests.c b/tests/msc_vlr/msc_vlr_tests.c
index 1192cf2..fd196c8 100644
--- a/tests/msc_vlr/msc_vlr_tests.c
+++ b/tests/msc_vlr/msc_vlr_tests.c
@@ -161,13 +161,18 @@
                OSMO_ASSERT(gsup_tx_confirmed);
 }

-bool conn_exists(struct gsm_subscriber_connection *conn)
+bool conn_exists(const struct gsm_subscriber_connection *conn)
 {
        struct gsm_subscriber_connection *c;
+
+       if (!conn)
+               return false;
+
        llist_for_each_entry(c, &net->subscr_conns, entry) {
                if (c == conn)
                        return true;
        }
+
        return false;
 }

@@ -212,7 +217,7 @@
            ran_type_name(rx_from_ran),
            gh_type_name(gh));

-       if (g_conn && !conn_exists(g_conn))
+       if (!conn_exists(g_conn))
                g_conn = NULL;

        if (!g_conn) {
@@ -230,7 +235,7 @@
                        msc_dtap(g_conn, 23, msg);
        }

-       if (g_conn && !conn_exists(g_conn))
+       if (!conn_exists(g_conn))
                g_conn = NULL;
 }

@@ -258,7 +263,7 @@
        bh->type = BSSAP_MSG_BSS_MANAGEMENT;
        bh->length = msgb_l3len(msg);

-       if (g_conn && !conn_exists(g_conn))
+       if (!conn_exists(g_conn))
                g_conn = NULL;

        OSMO_ASSERT(g_conn);
diff --git a/tests/msc_vlr/msc_vlr_tests.h b/tests/msc_vlr/msc_vlr_tests.h
index cc200bd..40377c1 100644
--- a/tests/msc_vlr/msc_vlr_tests.h
+++ b/tests/msc_vlr/msc_vlr_tests.h
@@ -152,7 +152,7 @@
 struct msgb *msgb_from_hex(const char *label, uint16_t size, const char *hex);

 void clear_vlr();
-bool conn_exists(struct gsm_subscriber_connection *conn);
+bool conn_exists(const struct gsm_subscriber_connection *conn);
 void conn_conclude_cm_service_req(struct gsm_subscriber_connection *conn,
                                  enum ran_type via_ran);


--
To view, visit https://gerrit.osmocom.org/11458
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Icf507d094319123c6667ba963db1d385df4d4f92
Gerrit-Change-Number: 11458
Gerrit-PatchSet: 3
Gerrit-Owner: Max <msur...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to