mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 19:12:59 +08:00
subsequence_in_string: fix broken optimization
haystack.size() > haystack.size() is always false change it to needle.size() > haystack.size() as seems intended
This commit is contained in:
parent
21c09c392b
commit
7340761b21
|
@ -120,8 +120,8 @@ bool string_suffixes_string_case_insensitive(const wcstring &proposed_suffix,
|
|||
/// Returns true if needle, represented as a subsequence, is contained within haystack.
|
||||
/// Note subsequence is not substring: "foo" is a subsequence of "follow" for example.
|
||||
static bool subsequence_in_string(const wcstring &needle, const wcstring &haystack) {
|
||||
// Impossible if haystack is larger than string.
|
||||
if (haystack.size() > haystack.size()) {
|
||||
// Impossible if needle is larger than haystack.
|
||||
if (needle.size() > haystack.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user