<p><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/18913">View Change</a></p><p>3 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/include/osmocom/mgcp/mgcp_endp.h">File include/osmocom/mgcp/mgcp_endp.h:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/include/osmocom/mgcp/mgcp_endp.h@44">Patch Set #1, Line 44:</a> <code style="font-family:monospace,monospace">#define OSMO_RTP_MSG_CTX(MSGB) (*(struct osmo_rtp_msg_ctx**)&((MSGB)->dst))</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Ack</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I was going to use a pointer to an externally stored struct,<br>and so using cb[0] didn't work, because assuming that unsigned long is guaranteed the size of a void* is bad, and gcc complains:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">../../../../src/osmo-mgw/include/osmocom/mgcp/mgcp_endp.h:44:43: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]<br> #define OSMO_RTP_MSG_CTX(MSGB) (*((struct osmo_rtp_msg_ctx**)&((MSGB)->cb[0])))</pre><p style="white-space: pre-wrap; word-wrap: break-word;">But I see your approach uses the cb[] as storage itself.<br>Let's see, hopefully cb[] is large enough to store the entire struct.<br>Adding a static assert to ensure that, and it passes.</p><p style="white-space: pre-wrap; word-wrap: break-word;">(Now of course no other msg->cb can be used anymore)</p><p style="white-space: pre-wrap; word-wrap: break-word;">Making the struct part of the msgb is indeed nicer.<br>But on another note: are we really ever going to remove the dst pointer from msgb??</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/src/libosmo-mgcp/mgcp_network.c">File src/libosmo-mgcp/mgcp_network.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/src/libosmo-mgcp/mgcp_network.c@1302">Patch Set #1, Line 1302:</a> <code style="font-family:monospace,monospace">      /* Since the msgb remains owned and freed by this function, the msg ctx data struct can just be on the stack and</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">It may be the case now and I'm ok with it, but in the long term I'd argue it makes more sense to tra […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">agreed, for another patch maybe</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/18913/1/src/libosmo-mgcp/mgcp_network.c@1330">Patch Set #1, Line 1330:</a> <code style="font-family:monospace,monospace">static int rx_rtp(struct msgb *msg)</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">Move this function on top of rtp_data_net and then you can drop the forward reference of rx_rtp at t […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">the reason to keep it here is to show the diff to the previous code</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-mgw/+/18913">change 18913</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-mgw/+/18913"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-mgw </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I3af40b63bc49f8636d4e7ea2f8f83bb67f6619ee </div>
<div style="display:none"> Gerrit-Change-Number: 18913 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-CC: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 23 Jun 2020 14:57:22 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Comment-In-Reply-To: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>