<p>Kevin Harwell <strong>posted comments</strong> on this change.</p><p><a href="https://gerrit.asterisk.org/6501">View Change</a></p><p>Patch set 1:<span style="border-radius: 3px; display: inline-block; margin: 0 2px; padding: 4px;background-color: #ffd4d4;">Code-Review -1</span></p><p>(2 comments)</p><ul style="list-style: none; padding-left: 20px;"><li><p><a href="https://gerrit.asterisk.org/#/c/6501/1/res/res_pjsip/pjsip_message_filter.c">File res/res_pjsip/pjsip_message_filter.c:</a></p><ul style="list-style: none; padding-left: 20px;"><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6501/1/res/res_pjsip/pjsip_message_filter.c@160">Patch Set #1, Line 160:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">{<br>#ifdef AST_DEVMODE<br> char hdrbuf[512];<br> int hdrbuf_len;<br><br> hdrbuf_len = pjsip_uri_print(context, uri, hdrbuf, 512);<br> hdrbuf[hdrbuf_len] = '\0';<br> ast_debug(2, "%s: %s\n", msg, hdrbuf);<br>#endif<br>}<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">since you already have a separate function for this why not go ahead and check the debug level first before calling uri_print. This would save a copy on every call.</p></li><li><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/6501/1/res/res_pjsip/pjsip_message_filter.c@349">Patch Set #1, Line 349:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">static void print_uri_debug(enum uri_type ut, pjsip_rx_data *rdata, pjsip_hdr *hdr)<br>{<br>#ifdef AST_DEVMODE<br> pjsip_uri *local_uri = NULL;<br> char hdrbuf[512];<br> int hdrbuf_len;<br> char *request_uri;<br> pjsip_uri_context_e context = PJSIP_URI_IN_OTHER;<br> char header_name[32];<br><br> switch (ut) {<br> case(URI_TYPE_REQUEST):<br> context = PJSIP_URI_IN_REQ_URI;<br> strcpy(header_name, "Request"); /* Safe */<br> local_uri = rdata->msg_info.msg->line.req.uri;<br> break;<br> case(PJSIP_H_FROM):<br> strcpy(header_name, "From"); /* Safe */<br> context = PJSIP_URI_IN_FROMTO_HDR;<br> local_uri = pjsip_uri_get_uri(((pjsip_from_hdr *)hdr)->uri);<br> break;<br> case(PJSIP_H_TO):<br> strcpy(header_name, "To"); /* Safe */<br> context = PJSIP_URI_IN_FROMTO_HDR;<br> local_uri = pjsip_uri_get_uri(((pjsip_to_hdr *)hdr)->uri);<br> break;<br> case(PJSIP_H_CONTACT):<br> strcpy(header_name, "Contact"); /* Safe */<br> context = PJSIP_URI_IN_CONTACT_HDR;<br> local_uri = pjsip_uri_get_uri(((pjsip_contact_hdr *)hdr)->uri);<br> break;<br> }<br><br> hdrbuf_len = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, rdata->msg_info.msg->line.req.uri, hdrbuf, 512);<br> hdrbuf[hdrbuf_len] = '\0';<br> request_uri = ast_strdupa(hdrbuf);<br> hdrbuf_len = pjsip_uri_print(context, local_uri, hdrbuf, 512);<br> hdrbuf[hdrbuf_len] = '\0';<br><br> ast_debug(2, "There was a non sip(s) URI scheme in %s URI '%s' for request '%*.*s %s'\n",<br> header_name, hdrbuf,<br> (int)rdata->msg_info.msg->line.req.method.name.slen,<br> (int)rdata->msg_info.msg->line.req.method.name.slen,<br> rdata->msg_info.msg->line.req.method.name.ptr, request_uri);<br>#endif<br>}<br></pre></blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Same for this one. Check the debug level prior to processing everything.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/6501">change 6501</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.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.asterisk.org/6501"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: Ibb2f9f1d2dc7549da562af4cbd9156c44ffdd460 </div>
<div style="display:none"> Gerrit-Change-Number: 6501 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Fri, 15 Sep 2017 18:07:49 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>