mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
set: Skip a wcslen
This commit is contained in:
parent
bac2eef496
commit
351cd5bd4b
1 changed files with 5 additions and 5 deletions
|
@ -323,17 +323,17 @@ static maybe_t<split_var_t> split_var_and_indexes(const wchar_t *arg, env_mode_f
|
|||
const environment_t &vars,
|
||||
io_streams_t &streams) {
|
||||
split_var_t res{};
|
||||
const wchar_t *open_bracket = std::wcschr(arg, L'[');
|
||||
size_t varname_len = open_bracket ? open_bracket - arg : wcslen(arg);
|
||||
res.varname.assign(arg, varname_len);
|
||||
wcstring argstr{arg};
|
||||
auto open_bracket = argstr.find(L'[');
|
||||
res.varname.assign(arg, open_bracket == wcstring::npos ? argstr.size() : open_bracket);
|
||||
res.var = vars.get(res.varname, mode);
|
||||
if (!open_bracket) {
|
||||
if (open_bracket == wcstring::npos) {
|
||||
// Common case of no bracket.
|
||||
return res;
|
||||
}
|
||||
|
||||
long varsize = res.varsize();
|
||||
const wchar_t *p = open_bracket + 1;
|
||||
const wchar_t *p = arg + open_bracket + 1;
|
||||
while (*p != L']') {
|
||||
const wchar_t *end;
|
||||
long l_ind;
|
||||
|
|
Loading…
Reference in a new issue