<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>




<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 auto;">
<tbody>
<tr>
<td style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; overflow: hidden;" align="left" bgcolor="#ffffff">
<table border="0" cellpadding="0" cellspacing="0" style="width: 100%; border-collapse: separate; border-spacing: 0;">
<tbody>
<tr>
<td style="color: #333333; border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid; font-size: 15px; font-weight: bold; line-height: 1.4; padding: 20px 0;">
Merge request <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1479">!1479</a> was reviewed by <a href="https://gitlab.com/dueno">Daiki Ueno</a>
</td>
</tr>
<tr>
<td style="overflow: hidden; font-size: 14px; line-height: 1.4; display: grid;">
<p style="color: #777777;">
<a href="https://gitlab.com/dueno">Daiki Ueno</a>
started a new
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1479#note_709355079">lib/priority.c</a>:
</p>
<table>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="1680" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
1680
</td>
<td class="new_line diff-line-num" data-linenumber="1681" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
1681
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC1681" class="line" lang="c">   <span class="k" style="font-weight: 600;">for</span> <span class="p">(</span><span class="n" style="color: #333;">j</span><span class="o" style="font-weight: 600;">=</span><span class="mi" style="color: #099;">0</span><span class="p">;</span><span class="n" style="color: #333;">j</span><span class="o" style="font-weight: 600;"><</span><span class="n" style="color: #333;">priority_cache</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">_cipher</span><span class="p">.</span><span class="n" style="color: #333;">num_priorities</span><span class="p">;</span><span class="n" style="color: #333;">j</span><span class="o" style="font-weight: 600;">++</span><span class="p">)</span> <span class="p">{</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="1681" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
1681
</td>
<td class="new_line diff-line-num" data-linenumber="1682" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
1682
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC1682" class="line" lang="c">           <span class="k" style="font-weight: 600;">for</span> <span class="p">(</span><span class="n" style="color: #333;">z</span><span class="o" style="font-weight: 600;">=</span><span class="mi" style="color: #099;">0</span><span class="p">;</span><span class="n" style="color: #333;">z</span><span class="o" style="font-weight: 600;"><</span><span class="n" style="color: #333;">priority_cache</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">_mac</span><span class="p">.</span><span class="n" style="color: #333;">num_priorities</span><span class="p">;</span><span class="n" style="color: #333;">z</span><span class="o" style="font-weight: 600;">++</span><span class="p">)</span> <span class="p">{</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="1682" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="1683" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
1683
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC1683" class="line" lang="c">                   <span class="k" style="font-weight: 600;">if</span> <span class="p">(</span><span class="n" style="color: #333;">priority_cache</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">cs</span><span class="p">.</span><span class="n" style="color: #333;">size</span> <span class="o" style="font-weight: 600;">==</span> <span class="n" style="color: #333;">MAX_CIPHERSUITE_SIZE</span><span class="p">)</span></span>
</pre>
</td>
</tr>

</table>
<div style="border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid;">
<p dir="auto">Is my understanding correct that this is expanded like this to avoid the unnecessary call to <code>cipher_suite_get</code>? As I expect the compiler would do this kind of job as part of optimization, I would suggest moving this <code>if</code> to <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1479/diffs#dc3111175f1ef48ddba45e288e07e48088695bdb_1689_1698" data-original="line 1698" data-link="true" data-link-reference="true" data-project="179611" data-merge-request="122158989" data-project-path="gnutls/gnutls" data-iid="1479" data-mr-title="make insecure-hash filter out ciphersuites on ->prf as well" data-reference-type="merge_request" data-container="body" data-placement="top" title="" class="gfm gfm-merge_request">line 1698</a>, as it would be a little clearer why <code>cs.size</code> is checked.</p>
</div>

<p style="color: #777777;">
<a href="https://gitlab.com/dueno">Daiki Ueno</a>
started a new
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1479#note_709355086">lib/priority.c</a>:
</p>
<table>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="1693" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
1693
</td>
<td class="new_line diff-line-num" data-linenumber="1703" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
1703
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC1703" class="line" lang="c">           <span class="k" style="font-weight: 600;">for</span> <span class="p">(</span><span class="n" style="color: #333;">j</span><span class="o" style="font-weight: 600;">=</span><span class="mi" style="color: #099;">0</span><span class="p">;</span><span class="n" style="color: #333;">j</span><span class="o" style="font-weight: 600;"><</span><span class="n" style="color: #333;">priority_cache</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">_cipher</span><span class="p">.</span><span class="n" style="color: #333;">num_priorities</span><span class="p">;</span><span class="n" style="color: #333;">j</span><span class="o" style="font-weight: 600;">++</span><span class="p">)</span> <span class="p">{</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="1694" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
1694
</td>
<td class="new_line diff-line-num" data-linenumber="1704" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #f0f0f0; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#fafafa">
1704
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC1704" class="line" lang="c">                   <span class="k" style="font-weight: 600;">for</span> <span class="p">(</span><span class="n" style="color: #333;">z</span><span class="o" style="font-weight: 600;">=</span><span class="mi" style="color: #099;">0</span><span class="p">;</span><span class="n" style="color: #333;">z</span><span class="o" style="font-weight: 600;"><</span><span class="n" style="color: #333;">priority_cache</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">_mac</span><span class="p">.</span><span class="n" style="color: #333;">num_priorities</span><span class="p">;</span><span class="n" style="color: #333;">z</span><span class="o" style="font-weight: 600;">++</span><span class="p">)</span> <span class="p">{</span></span>
</pre>
</td>
</tr>
<tr class="line_holder new" id="">
<td class="old_line diff-line-num new" data-linenumber="1695" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
 
</td>
<td class="new_line diff-line-num new" data-linenumber="1705" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #c7f0d2; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#ddfbe6">
1705
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC1705" class="line" lang="c">                           <span class="k" style="font-weight: 600;">if</span> <span class="p">(</span><span class="n" style="color: #333;">priority_cache</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">cs</span><span class="p">.</span><span class="n" style="color: #333;">size</span> <span class="o" style="font-weight: 600;">==</span> <span class="n" style="color: #333;">MAX_CIPHERSUITE_SIZE</span><span class="p">)</span></span>
</pre>
</td>
</tr>

</table>
<div style="border-bottom-width: 1px; border-bottom-color: #ededed; border-bottom-style: solid;">
<p dir="auto">Same here.</p>
</div>

</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
Reply to this email directly or <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1479">view it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.com.
If you'd like to receive fewer emails, you can
<a href="https://gitlab.com/-/sent_notifications/9b867601c151da73d80f4e8e85c18c6f/unsubscribe">unsubscribe</a>
from this thread or
adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Merge request","url":"https://gitlab.com/gnutls/gnutls/-/merge_requests/1479"}}</script>


</p>
</div>
</body>
</html>