mirror of
https://github.com/dlang/phobos.git
synced 2025-05-03 00:20:26 +03:00
Merge pull request #1058 from andralex/5726
Issue 5726 - boyerMooreFinder hangs when finding
This commit is contained in:
commit
10d28218d8
1 changed files with 8 additions and 1 deletions
|
@ -3979,7 +3979,7 @@ public:
|
|||
if (npos == 0) return haystack[hpos .. $];
|
||||
--npos;
|
||||
}
|
||||
hpos += max(skip[npos], npos - occurrence(haystack[npos+hpos]));
|
||||
hpos += max(skip[npos], cast(sizediff_t) npos - occurrence(haystack[npos+hpos]));
|
||||
}
|
||||
return haystack[$ .. $];
|
||||
}
|
||||
|
@ -4027,6 +4027,13 @@ unittest
|
|||
assert(find(b, boyerMooreFinder(a)).empty);
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
auto bm = boyerMooreFinder("for");
|
||||
auto match = find("Moor", bm);
|
||||
assert(match.empty);
|
||||
}
|
||||
|
||||
/**
|
||||
Advances the input range $(D haystack) by calling $(D haystack.popFront)
|
||||
until either $(D pred(haystack.front)), or $(D
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue