Change in libosmo-abis[master]: lapd: Replace magic numbers with #defines

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

laforge gerrit-no-reply at lists.osmocom.org
Fri Jul 3 17:32:46 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/19125 )

Change subject: lapd: Replace magic numbers with #defines
......................................................................

lapd: Replace magic numbers with #defines

Related: OS#4644
Change-Id: I2971fb5bb27a7024abac7e2a4414eaf61f27ccb5
---
M src/input/lapd.c
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/input/lapd.c b/src/input/lapd.c
index 4bcece5..9bab5a9 100644
--- a/src/input/lapd.c
+++ b/src/input/lapd.c
@@ -82,6 +82,9 @@
 #define LOGSAP(sap, level, fmt, args ...) \
 	LOGP(DLLAPD, level, "%s: " fmt, (sap)->dl.name, ## args)
 
+#define DLSAP_MSGB_SIZE		56
+#define DLSAP_MSGB_HEADROOM	56
+
 const struct lapd_profile lapd_profile_isdn = {
 	.k		= LAPD_SET_K(7,7),
 	.n200		= 3,
@@ -349,7 +352,7 @@
 		/* Send ACCEPT */
 		memmove(resp, "\xfe\xff\x03\x0f\x00\x00\x02\x00", 8);
 		resp[7] = (action << 1) | 1;
-		msg = msgb_alloc_headroom(56, 56, "DL EST");
+		msg = msgb_alloc_headroom(DLSAP_MSGB_SIZE, DLSAP_MSGB_HEADROOM, "DL EST");
 		msg->l2h = msgb_push(msg, 8);
 		memcpy(msg->l2h, resp, 8);
 
@@ -521,7 +524,7 @@
 	LOGSAP(sap, LOGL_NOTICE, "LAPD DL-ESTABLISH request TEI=%d SAPI=%d\n", tei, sapi);
 
 	/* prepare prim */
-	msg = msgb_alloc_headroom(56, 56, "DL EST");
+	msg = msgb_alloc_headroom(DLSAP_MSGB_SIZE, DLSAP_MSGB_HEADROOM, "DL EST");
 	msg->l3h = msg->data;
         osmo_prim_init(&dp.oph, 0, PRIM_DL_EST, PRIM_OP_REQUEST, msg);
 
@@ -548,7 +551,7 @@
 	LOGSAP(sap, LOGL_NOTICE, "LAPD DL-RELEASE request TEI=%d SAPI=%d\n", tei, sapi);
 
 	/* prepare prim */
-	msg = msgb_alloc_headroom(56, 56, "DL REL");
+	msg = msgb_alloc_headroom(DLSAP_MSGB_SIZE, DLSAP_MSGB_HEADROOM, "DL REL");
 	msg->l3h = msg->data;
         osmo_prim_init(&dp.oph, 0, PRIM_DL_REL, PRIM_OP_REQUEST, msg);
 

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/19125
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I2971fb5bb27a7024abac7e2a4414eaf61f27ccb5
Gerrit-Change-Number: 19125
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200703/a85d934e/attachment.htm>


More information about the gerrit-log mailing list