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

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
---
M openbsc/src/osmo-bsc_nat/bsc_sccp.c
1 file changed, 4 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/85/2285/1

diff --git a/openbsc/src/osmo-bsc_nat/bsc_sccp.c 
b/openbsc/src/osmo-bsc_nat/bsc_sccp.c
index 25c13d4..c6c265f 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_sccp.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_sccp.c
@@ -45,7 +45,7 @@
        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 @@
        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 @@
        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 *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;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9fac7cabedff74f8f6293ad8b54420229b80aa71
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>

Reply via email to