fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/35321?usp=email )
Change subject: mgcp: simplify getting msgb tail in mgcp_msg_terminate_nul() ......................................................................
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(-)
Approvals: pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified daniel: Looks good to me, approved
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)