cleanup env code and contains()

Switch from null terminated arrays to `wcstring_list_t` for lists of
special env var names. Rename `list_contains_string` to `contains` and
modify the latter interface to not rely on a `#define`.

Rename `list_contains_string()` to `contains()` and eliminate the
current variadic implementation. Update all callers of the removed
version to use the string list version.
This commit is contained in:
Kurtis Rader
2017-04-04 21:28:57 -07:00
parent 75600b6b53
commit 03571b82be
12 changed files with 63 additions and 98 deletions

View File

@@ -875,7 +875,7 @@ parse_execution_result_t parse_execution_context_t::populate_plain_process(
// If we have defined a wrapper around cd, use it, otherwise use the cd builtin.
process_type = function_exists(L"cd") ? INTERNAL_FUNCTION : INTERNAL_BUILTIN;
} else {
const globspec_t glob_behavior = contains(cmd, L"set", L"count") ? nullglob : failglob;
const globspec_t glob_behavior = (cmd == L"set" || cmd == L"count") ? nullglob : failglob;
// Form the list of arguments. The command is the first argument. TODO: count hack, where we
// treat 'count --help' as different from 'count $foo' that expands to 'count --help'. fish
// 1.x never successfully did this, but it tried to!