[MERGED] openbsc[master]: nat: Use equal func in bsc_sccp

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Mon Apr 24 10:01:21 UTC 2017


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: nat: Use equal func in bsc_sccp
......................................................................


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(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  Holger Freyther: Looks good to me, approved



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: merged
Gerrit-Change-Id: I9fac7cabedff74f8f6293ad8b54420229b80aa71
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list