mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:37:34 +00:00
AK: Add an optional starting offset to CircularBuffer::offset_of
This parameter allows to start searching after an offset. For example, to resume a search. It is unfortunately a breaking change in API so this patch also modifies one user and one test.
This commit is contained in:
parent
34922c0cc0
commit
9a7accddb7
4 changed files with 57 additions and 9 deletions
|
@ -719,7 +719,7 @@ public:
|
|||
Optional<size_t> longest_match;
|
||||
size_t match_size = 0;
|
||||
for (auto& candidate : candidates) {
|
||||
auto const result = m_buffer.offset_of(candidate, readable_size);
|
||||
auto const result = m_buffer.offset_of(candidate, {}, readable_size);
|
||||
if (result.has_value()) {
|
||||
auto previous_match = longest_match.value_or(*result);
|
||||
if ((previous_match < *result) || (previous_match == *result && match_size < candidate.length())) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue