<!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">

<p style="color: #777777;">
<a href="https://gitlab.com/asosedkin">Alexander Sosedkin</a>
started a new
discussion on <a href="https://gitlab.com/gnutls/gnutls/-/merge_requests/1401#note_526400066">lib/str.c</a>:
</p>
<table>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="155" 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">
155
</td>
<td class="new_line diff-line-num" data-linenumber="146" 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">
146
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC146" class="line" lang="c"></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="156" 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">
156
</td>
<td class="new_line diff-line-num" data-linenumber="147" 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">
147
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC147" class="line" lang="c">    <span class="n" style="color: #333;">unused</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">MEMSUB</span><span class="p">(</span><span class="n" style="color: #333;">dest</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">data</span><span class="p">,</span> <span class="n" style="color: #333;">dest</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">allocd</span><span class="p">);</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="157" 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">
157
</td>
<td class="new_line diff-line-num" data-linenumber="148" 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">
148
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC148" class="line" lang="c">    <span class="n" style="color: #333;">dest</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">allocd</span> <span class="o" style="font-weight: 600;">=</span></span>
</pre>
</td>
</tr>
<tr class="line_holder old" id="">
<td class="old_line diff-line-num old" data-linenumber="158" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
158
</td>
<td class="new_line diff-line-num old" data-linenumber="149" style="width: 35px; color: rgba(0,0,0,0.3); border-right-width: 1px; border-right-color: #fac5cd; border-right-style: solid; padding: 0 5px;" align="right" bgcolor="#f9d7dc">
 
</td>
<td class="line_content old" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#fbe9eb">
<pre style="margin: 0;">-<span id="LC158" class="line" lang="c">        <span class="n" style="color: #333;">gnutls_realloc_fast</span><span class="p">(</span><span class="n" style="color: #333;">dest</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">allocd</span><span class="p">,</span> <span class="n" style="color: #333;">new_size</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="159" 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="149" 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">
149
</td>
<td class="line_content new" style="padding-left: 0.5em; padding-right: 0.5em;" bgcolor="#ecfdf0">
<pre style="margin: 0;">+<span id="LC149" class="line" lang="c">        <span class="n" style="color: #333;">gnutls_realloc_fast</span><span class="p">(</span><span class="n" style="color: #333;">dest</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">allocd</span><span class="p">,</span> <span class="n" style="color: #333;">new_size</span><span class="idiff left"> </span><span class="o" style="font-weight: 600;"><span class="idiff">+</span></span><span class="idiff"> </span><span class="n" style="color: #333;"><span class="idiff right">unused</span></span><span class="p">);</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="159" 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">
159
</td>
<td class="new_line diff-line-num" data-linenumber="150" 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">
150
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC150" class="line" lang="c">    <span class="k" style="font-weight: 600;">if</span> <span class="p">(</span><span class="n" style="color: #333;">dest</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">allocd</span> <span class="o" style="font-weight: 600;">==</span> <span class="nb" style="color: #0086b3;">NULL</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="160" 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">
160
</td>
<td class="new_line diff-line-num" data-linenumber="151" 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">
151
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC151" class="line" lang="c">            <span class="n" style="color: #333;">gnutls_assert</span><span class="p">();</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="161" 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">
161
</td>
<td class="new_line diff-line-num" data-linenumber="152" 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">
152
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC152" class="line" lang="c">            <span class="k" style="font-weight: 600;">return</span> <span class="n" style="color: #333;">GNUTLS_E_MEMORY_ERROR</span><span class="p">;</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="162" 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">
162
</td>
<td class="new_line diff-line-num" data-linenumber="153" 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">
153
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC153" class="line" lang="c">    <span class="p">}</span></span>
</pre>
</td>
</tr>
<tr class="line_holder" id="">
<td class="old_line diff-line-num" data-linenumber="163" 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">
163
</td>
<td class="new_line diff-line-num" data-linenumber="154" 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">
154
</td>
<td class="line_content" style="padding-left: 0.5em; padding-right: 0.5em;">
<pre style="margin: 0;"> <span id="LC154" class="line" lang="c">    <span class="n" style="color: #333;">dest</span><span class="o" style="font-weight: 600;">-></span><span class="n" style="color: #333;">max_length</span> <span class="o" style="font-weight: 600;">=</span> <span class="n" style="color: #333;">new_size</span><span class="p">;</span></span>
</pre>
</td>
</tr>

</table>
<div style="">
<p dir="auto"><code>new_size</code> or <code>new_size + unused</code>?</p>
</div>


</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/1401#note_526400066">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/76dbe8776f56890d0bea12f3919e66f3/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/1401#note_526400066"}}</script>


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