Skip to content

Commit

Permalink
Lucene.Net.Analsis.TokenAttributes.CharTermAttribute::ResizeBuffer():…
Browse files Browse the repository at this point in the history
… Use Array.Resize() rather than copy (#261)
  • Loading branch information
NightOwl888 committed Jun 30, 2020
1 parent c7f23fa commit 98c0295
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public char[] ResizeBuffer(int newSize)
{
// Not big enough; create a new array with slight
// over allocation and preserve content
char[] newCharBuffer = new char[ArrayUtil.Oversize(newSize, RamUsageEstimator.NUM_BYTES_CHAR)];
Array.Copy(termBuffer, 0, newCharBuffer, 0, termBuffer.Length);
termBuffer = newCharBuffer;

// LUCENENET: Resize rather than copy
Array.Resize(ref termBuffer, ArrayUtil.Oversize(newSize, RamUsageEstimator.NUM_BYTES_CHAR));
}
return termBuffer;
}
Expand Down

0 comments on commit 98c0295

Please sign in to comment.