msc_vlr_tests: tweak conn_exists()

* constify function parameter
* internalize parameter check

Change-Id: Icf507d094319123c6667ba963db1d385df4d4f92
changes/58/11458/3
Maxim Suraev 4 years ago committed by Harald Welte
parent 6038ad4cf9
commit ba8a007a2d
  1. 13
      tests/msc_vlr/msc_vlr_tests.c
  2. 2
      tests/msc_vlr/msc_vlr_tests.h

@ -161,13 +161,18 @@ void gsup_rx(const char *rx_hex, const char *expect_tx_hex)
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 @@ void rx_from_ms(struct msgb *msg)
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 @@ void rx_from_ms(struct msgb *msg)
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 @@ void bss_sends_bssap_mgmt(const char *hex)
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);

@ -152,7 +152,7 @@ extern msc_vlr_test_func_t msc_vlr_tests[];
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);

Loading…
Cancel
Save