Skip to content

Commit 46a7034

Browse files
committed
Drop redundant autogrowing
1 parent 9bfcf1e commit 46a7034

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

LibGit2Sharp/Core/GitBufWriteStream.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,9 @@ public override int Read(byte[] buffer, int offset, int count)
3737

3838
public override void Write(byte[] buffer, int offset, int count)
3939
{
40-
AutoGrowBuffer(count);
41-
4240
Proxy.git_buf_put(gitBufPointer, buffer, offset, count);
4341
}
4442

45-
private void AutoGrowBuffer(int count)
46-
{
47-
var gitBuf = gitBufPointer.MarshalAs<GitBuf>();
48-
49-
var ulongCount = Convert.ToUInt64(count);
50-
var asize = (ulong)gitBuf.asize;
51-
var size = (ulong)gitBuf.size;
52-
53-
var isBufferLargeEnoughToHoldTheNewData = (asize - size) > ulongCount;
54-
var filledBufferPercentage = (100.0 * size / asize);
55-
56-
if (isBufferLargeEnoughToHoldTheNewData && filledBufferPercentage < 90)
57-
{
58-
return;
59-
}
60-
61-
var targetSize = (ulong)(1.5 * (asize + ulongCount));
62-
63-
Proxy.git_buf_grow(gitBufPointer, targetSize);
64-
}
65-
6643
public override bool CanRead
6744
{
6845
get { return false; }

0 commit comments

Comments
 (0)