mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 07:43:18 +08:00
math: Don't match longer function names
The comparison here is a bit naive, so "n" matches "ncr", so technically math 'n(2, 3)' is equivalent to math 'ncr(2, 3)' Work towards #7508.
This commit is contained in:
parent
6d98939445
commit
903a9fbf0c
|
@ -222,7 +222,7 @@ static const te_builtin *find_builtin(const char *name, int len) {
|
|||
return std::strncmp(lhs.name, rhs, len) < 0;
|
||||
});
|
||||
// We need to compare again because we might have gotten the first "larger" element.
|
||||
if (found != end && std::strncmp(found->name, name, len) == 0) return found;
|
||||
if (found != end && std::strncmp(found->name, name, len) == 0 && found->name[len] == 0) return found;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user