From 3d98fd43081d4d27f2c89af313b23ca618218f9c Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 16 Apr 2022 12:22:44 -0700 Subject: [PATCH] clang-format env.cpp and env_dispatch.cpp --- src/env.cpp | 8 ++++---- src/env_dispatch.cpp | 27 ++++++++++++++------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/env.cpp b/src/env.cpp index eacf24fa7..23137271e 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -768,10 +768,10 @@ maybe_t env_scoped_impl_t::try_get_computed(const wcstring &key) cons maybe_t env_scoped_impl_t::try_get_local(const wcstring &key) const { maybe_t entry; - for (auto cur = locals_; cur; cur=cur->next) { + for (auto cur = locals_; cur; cur = cur->next) { if ((entry = cur->find_entry(key))) break; } - return entry; // this is either the entry or none() from find_entry + return entry; // this is either the entry or none() from find_entry } maybe_t env_scoped_impl_t::try_get_function(const wcstring &key) const { @@ -784,10 +784,10 @@ maybe_t env_scoped_impl_t::try_get_function(const wcstring &key) cons // topmost local scope. if (node->new_scope) break; } - for (auto cur = node; cur; cur=cur->next) { + for (auto cur = node; cur; cur = cur->next) { if ((entry = cur->find_entry(key))) break; } - return entry; // this is either the entry or none() from find_entry + return entry; // this is either the entry or none() from find_entry } maybe_t env_scoped_impl_t::try_get_global(const wcstring &key) const { diff --git a/src/env_dispatch.cpp b/src/env_dispatch.cpp index 4e477754b..fc5aad3a7 100644 --- a/src/env_dispatch.cpp +++ b/src/env_dispatch.cpp @@ -61,16 +61,11 @@ /// List of all locale environment variable names that might trigger (re)initializing the locale /// subsystem. These are only the variables we're possibly interested in. -static const wcstring locale_variables[] = {L"LANG", - L"LANGUAGE", - L"LC_ALL", - L"LC_COLLATE", - L"LC_CTYPE", - L"LC_MESSAGES", - L"LC_NUMERIC", - L"LC_TIME", - L"fish_allow_singlebyte_locale", - L"LOCPATH"}; +static const wcstring locale_variables[] = { + L"LANG", L"LANGUAGE", L"LC_ALL", + L"LC_COLLATE", L"LC_CTYPE", L"LC_MESSAGES", + L"LC_NUMERIC", L"LC_TIME", L"fish_allow_singlebyte_locale", + L"LOCPATH"}; /// List of all curses environment variable names that might trigger (re)initializing the curses /// subsystem. @@ -467,15 +462,21 @@ static bool initialize_curses_using_fallback(const char *term) { // seeing if the fallback name can be used. auto &vars = env_stack_t::globals(); auto term_var = vars.get(L"TERM"); - if (term_var.missing_or_empty()) return false; + if (term_var.missing_or_empty()) { + return false; + } auto term_env = wcs2string(term_var->as_string()); - if (term_env == DEFAULT_TERM1 || term_env == DEFAULT_TERM2) return false; + if (term_env == DEFAULT_TERM1 || term_env == DEFAULT_TERM2) { + return false; + } if (is_interactive_session()) FLOGF(warning, _(L"Using fallback terminal type '%s'."), term); int err_ret; - if (setupterm(const_cast(term), STDOUT_FILENO, &err_ret) == OK) return true; + if (setupterm(const_cast(term), STDOUT_FILENO, &err_ret) == OK) { + return true; + } if (is_interactive_session()) { FLOGF(warning, _(L"Could not set up terminal using the fallback terminal type '%s'."), term);