Switch env_var to using maybe_t

This eliminates the "missing" notion of env_var_t. Instead
env_get returns a maybe_t<env_var_t>, which forces callers to
handle the possibility that the variable is missing.
This commit is contained in:
ridiculousfish
2017-08-28 00:25:41 -07:00
parent 18203a081c
commit 3d40292c00
23 changed files with 202 additions and 242 deletions

View File

@@ -201,8 +201,8 @@ static int input_function_args_index = 0;
/// Return the current bind mode.
wcstring input_get_bind_mode() {
env_var_t mode = env_get(FISH_BIND_MODE_VAR);
return mode.missing() ? DEFAULT_BIND_MODE : mode.as_string();
auto mode = env_get(FISH_BIND_MODE_VAR);
return mode ? mode->as_string() : DEFAULT_BIND_MODE;
}
/// Set the current bind mode.