mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-11 22:21:14 -03:00
Use const_strlen in a few different places
This may slightly improve performance by allowing the compiler greater visibility into what is happing on top of not executing at runtime in some hot paths, but more importantly, it gets rid of magic constants in a few different places.
This commit is contained in:
@@ -63,7 +63,8 @@ static bool should_exit(wchar_t wc) {
|
||||
std::fwprintf(stderr, L"Press [ctrl-%c] again to exit\n", shell_modes.c_cc[VEOF] + 0x40);
|
||||
return false;
|
||||
}
|
||||
return std::memcmp(recent_chars, "exit", 4) == 0 || std::memcmp(recent_chars, "quit", 4) == 0;
|
||||
return std::memcmp(recent_chars, "exit", const_strlen("exit")) == 0 ||
|
||||
std::memcmp(recent_chars, "quit", const_strlen("quit")) == 0;
|
||||
}
|
||||
|
||||
/// Return the name if the recent sequence of characters matches a known terminfo sequence.
|
||||
|
||||
Reference in New Issue
Block a user