Skip to content

Commit d2efaa3

Browse files
committed
Update CrossChunkMatcher.cs
1 parent 9c5d0f6 commit d2efaa3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Verify/Serialization/Scrubbers/CrossChunkMatcher.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ public static void ReplaceAll<TContext>(
3232
var absolutePosition = position + chunkIndex;
3333

3434
// Build content window starting at current position
35-
var bufferLength = FillBuffer(builder, absolutePosition, buffer);
35+
var windowSlice = FillBuffer(builder, absolutePosition, buffer);
3636

37-
// Check for match at this position
38-
var windowSlice = buffer[..bufferLength];
3937
var potentialMatch = matcher(windowSlice, absolutePosition, context);
4038

4139
if (potentialMatch == null)
@@ -69,7 +67,7 @@ public static void ReplaceAll<TContext>(
6967
}
7068
}
7169

72-
static int FillBuffer(StringBuilder builder, int start, Span<char> buffer)
70+
static Span<char> FillBuffer(StringBuilder builder, int start, Span<char> buffer)
7371
{
7472
var bufferIndex = 0;
7573
var currentPosition = 0;
@@ -103,8 +101,7 @@ static int FillBuffer(StringBuilder builder, int start, Span<char> buffer)
103101

104102
currentPosition = chunkEnd;
105103
}
106-
107-
return bufferIndex;
104+
return buffer[..bufferIndex];
108105
}
109106

110107
/// <summary>

0 commit comments

Comments
 (0)