mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 06:24:01 +00: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
1 changed files with 1 additions and 1 deletions
|
@ -222,7 +222,7 @@ static const te_builtin *find_builtin(const char *name, int len) {
|
||||||
return std::strncmp(lhs.name, rhs, len) < 0;
|
return std::strncmp(lhs.name, rhs, len) < 0;
|
||||||
});
|
});
|
||||||
// We need to compare again because we might have gotten the first "larger" element.
|
// 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;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue