fixeria submitted this change.

View Change


Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified daniel: Looks good to me, approved
mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul()

The current statement:

msg->l2h + msgb_l2len(msg)

looks as follows, if we expand the msgb_l2len():

msg->l2h + msgb->tail - msg->l2h

so this is basically equal to msgb->tail alone.

Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54
Related: CID#272990
---
M include/osmocom/mgcp/mgcp_common.h
1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/include/osmocom/mgcp/mgcp_common.h b/include/osmocom/mgcp/mgcp_common.h
index 7de45f9..be5a0d6 100644
--- a/include/osmocom/mgcp/mgcp_common.h
+++ b/include/osmocom/mgcp/mgcp_common.h
@@ -68,7 +68,7 @@
/* Ensure that the msg->l2h is NUL terminated. */
static inline int mgcp_msg_terminate_nul(struct msgb *msg)
{
- unsigned char *tail = msg->l2h + msgb_l2len(msg); /* char after l2 data */
+ unsigned char *tail = msg->tail; /* char after l2 data */
if (tail[-1] == '\0')
/* nothing to do */;
else if (msgb_tailroom(msg) > 0)

To view, visit change 35321. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I4f4b0f792bbeef94a5449c4a5843628a703a3d54
Gerrit-Change-Number: 35321
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann@sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: pespin <pespin@sysmocom.de>
Gerrit-CC: laforge <laforge@osmocom.org>
Gerrit-MessageType: merged