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
This commit is contained in:
Vadim Yanitskiy 2023-12-11 20:59:44 +07:00 committed by fixeria
parent 18717f5247
commit a68a863b9d
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,7 @@ struct mgcp_codec_param {
/* 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)