Skip to content

Commit

Permalink
Replace some uses of Span.Fill with Span.Clear (#51428)
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabYourPitchforks authored Apr 17, 2021
1 parent 2eff789 commit 49bce33
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/libraries/Common/src/System/Net/MultiArrayBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public void GrowAvailableSpace(int byteCount)
_blocks.AsSpan().Slice((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(_blocks);

// Null out the part of the array left over from the shift, so that we aren't holding references to those blocks.
_blocks.AsSpan().Slice((int)usedBlocks, (int)unusedInitialBlocks).Fill(null);
_blocks.AsSpan().Slice((int)usedBlocks, (int)unusedInitialBlocks).Clear();
}

uint shift = unusedInitialBlocks * BlockSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void HandleMapKeyWritten()
if (!keyEncodingRanges.Add(currentKey))
{
// reset writer state to right before the offending key write
_buffer.AsSpan(currentKey.Offset, _offset).Fill(0);
_buffer.AsSpan(currentKey.Offset, _offset).Clear();
_offset = currentKey.Offset;

throw new InvalidOperationException(SR.Format(SR.Cbor_ConformanceMode_ContainsDuplicateKeys, ConformanceMode));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ private void PatchIndefiniteLengthString(CborMajorType type)
// clean up
s_bufferPool.Return(tempBuffer);
_currentIndefiniteLengthStringRanges.Clear();
buffer.Slice(_offset, initialOffset - _offset).Fill(0x0);
buffer.Slice(_offset, initialOffset - _offset).Clear();
}
}
}

0 comments on commit 49bce33

Please sign in to comment.