aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-04-10 13:40:17 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-04-12 12:24:49 +0000
commitdc9de2352329ac5523e19d89f7e17fbd16c5e25a (patch)
tree23715f197c0fda3af504b12fd563994d343865e7
parentd75f11e6f26a50c11f73625de5c0833971900cde (diff)
nat: Use equal func in bsc_sccp
It is defined in the file and used twice in there, so let's use it for all of them which makes code smaller and more clear. Change-Id: I9fac7cabedff74f8f6293ad8b54420229b80aa71
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_sccp.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_sccp.c b/openbsc/src/osmo-bsc_nat/bsc_sccp.c
index 25c13d4f4..c6c265f7a 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_sccp.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_sccp.c
@@ -45,7 +45,7 @@ static int sccp_ref_is_free(struct sccp_source_reference *ref, struct bsc_nat *n
struct nat_sccp_connection *conn;
llist_for_each_entry(conn, &nat->sccp_connections, list_entry) {
- if (memcmp(ref, &conn->patched_ref, sizeof(*ref)) == 0)
+ if (equal(ref, &conn->patched_ref))
return -1;
}
@@ -91,7 +91,7 @@ struct nat_sccp_connection *create_sccp_src_ref(struct bsc_connection *bsc,
llist_for_each_entry(conn, &bsc->nat->sccp_connections, list_entry) {
if (conn->bsc != bsc)
continue;
- if (memcmp(&conn->real_ref, parsed->src_local_ref, sizeof(conn->real_ref)) != 0)
+ if (!equal(parsed->src_local_ref, &conn->real_ref))
continue;
/* the BSC has reassigned the SRC ref and we failed to keep track */
@@ -159,9 +159,7 @@ void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bs
struct nat_sccp_connection *conn;
llist_for_each_entry(conn, &bsc->nat->sccp_connections, list_entry) {
- if (memcmp(parsed->src_local_ref,
- &conn->patched_ref, sizeof(conn->patched_ref)) == 0) {
-
+ if (equal(parsed->src_local_ref, &conn->patched_ref)) {
sccp_connection_destroy(conn);
return;
}
@@ -241,7 +239,7 @@ struct nat_sccp_connection *bsc_nat_find_con_by_bsc(struct bsc_nat *nat,
struct nat_sccp_connection *conn;
llist_for_each_entry(conn, &nat->sccp_connections, list_entry) {
- if (memcmp(ref, &conn->real_ref, sizeof(*ref)) == 0)
+ if (equal(ref, &conn->real_ref))
return conn;
}