mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-07-03 18:21:16 -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:
@@ -461,9 +461,9 @@ static bool does_term_support_setting_title(const environment_t &vars) {
|
||||
const wcstring term_str = term_var->as_string();
|
||||
const wchar_t *term = term_str.c_str();
|
||||
bool recognized = contains(title_terms, term_var->as_string());
|
||||
if (!recognized) recognized = !std::wcsncmp(term, L"xterm-", std::wcslen(L"xterm-"));
|
||||
if (!recognized) recognized = !std::wcsncmp(term, L"screen-", std::wcslen(L"screen-"));
|
||||
if (!recognized) recognized = !std::wcsncmp(term, L"tmux-", std::wcslen(L"tmux-"));
|
||||
if (!recognized) recognized = !std::wcsncmp(term, L"xterm-", const_strlen(L"xterm-"));
|
||||
if (!recognized) recognized = !std::wcsncmp(term, L"screen-", const_strlen(L"screen-"));
|
||||
if (!recognized) recognized = !std::wcsncmp(term, L"tmux-", const_strlen(L"tmux-"));
|
||||
if (!recognized) {
|
||||
if (std::wcscmp(term, L"linux") == 0) return false;
|
||||
if (std::wcscmp(term, L"dumb") == 0) return false;
|
||||
|
||||
Reference in New Issue
Block a user