Use FirstSpan instead of calling First.Span (#18615)

This commit is contained in:
Nick Kirby 2020-01-31 20:51:40 +00:00 committed by GitHub
parent 91219a655b
commit d6cb79e64a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -121,7 +121,7 @@ namespace Microsoft.AspNetCore.WebUtilities
{ {
if (buffer.IsSingleSegment) if (buffer.IsSingleSegment)
{ {
ParseFormValuesFast(buffer.First.Span, ParseFormValuesFast(buffer.FirstSpan,
ref accumulator, ref accumulator,
isFinalBlock, isFinalBlock,
out var consumed); out var consumed);
@ -318,7 +318,7 @@ namespace Microsoft.AspNetCore.WebUtilities
{ {
if (ros.IsSingleSegment) if (ros.IsSingleSegment)
{ {
return GetDecodedString(ros.First.Span); return GetDecodedString(ros.FirstSpan);
} }
if (ros.Length < StackAllocThreshold) if (ros.Length < StackAllocThreshold)

View File

@ -222,7 +222,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
{ {
if (readableBuffer.IsSingleSegment) if (readableBuffer.IsSingleSegment)
{ {
writableBuffer.Write(readableBuffer.First.Span); writableBuffer.Write(readableBuffer.FirstSpan);
} }
else else
{ {

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
examined = buffer.End; examined = buffer.End;
// Prepare the first span // Prepare the first span
var span = buffer.First.Span; var span = buffer.FirstSpan;
var lineIndex = span.IndexOf(ByteLF); var lineIndex = span.IndexOf(ByteLF);
if (lineIndex >= 0) if (lineIndex >= 0)
{ {

View File

@ -21,7 +21,7 @@ namespace System.Buffers
{ {
if (buffer.IsSingleSegment) if (buffer.IsSingleSegment)
{ {
return buffer.First.Span; return buffer.FirstSpan;
} }
return buffer.ToArray(); return buffer.ToArray();
} }