diff --git a/src/expand.cpp b/src/expand.cpp index 42c44d8fa..2d517bf3c 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -181,8 +181,7 @@ wcstring expand_escape_variable(const env_var_t &var) { /// Parse an array slicing specification Returns 0 on success. If a parse error occurs, returns the /// index of the bad token. Note that 0 can never be a bad index because the string always starts /// with [. -static size_t parse_slice(const wchar_t *in, wchar_t **end_ptr, std::vector &idx, - std::vector &source_positions, size_t array_size) { +static size_t parse_slice(const wchar_t *in, wchar_t **end_ptr, std::vector &idx, size_t array_size) { const long size = (long)array_size; size_t pos = 1; // skip past the opening square brace @@ -255,7 +254,6 @@ static size_t parse_slice(const wchar_t *in, wchar_t **end_ptr, std::vector *out, siz size_t var_name_and_slice_stop = var_name_stop; bool all_values = true; const size_t slice_start = var_name_stop; - // List of indexes, and parallel array of source positions of each index in the variable list. std::vector var_idx_list; - std::vector var_pos_list; if (slice_start < insize && instr.at(slice_start) == L'[') { all_values = false; const wchar_t *in = instr.c_str(); @@ -380,8 +375,7 @@ static bool expand_variables(wcstring instr, std::vector *out, siz } else if (history) { effective_val_count = history->size(); } - size_t bad_pos = parse_slice(in + slice_start, &slice_end, var_idx_list, var_pos_list, - effective_val_count); + size_t bad_pos = parse_slice(in + slice_start, &slice_end, var_idx_list, effective_val_count); if (bad_pos != 0) { if (in[slice_start + bad_pos] == L'0') { append_syntax_error(errors, slice_start + bad_pos, @@ -657,13 +651,12 @@ static bool expand_cmdsubst(const wcstring &input, std::vector *ou tail_begin = paren_end + 1; if (*tail_begin == L'[') { std::vector slice_idx; - std::vector slice_source_positions; const wchar_t *const slice_begin = tail_begin; wchar_t *slice_end; size_t bad_pos; bad_pos = - parse_slice(slice_begin, &slice_end, slice_idx, slice_source_positions, sub_res.size()); + parse_slice(slice_begin, &slice_end, slice_idx, sub_res.size()); if (bad_pos != 0) { append_syntax_error(errors, slice_begin - in + bad_pos, L"Invalid index value"); return false;