mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-29 14:23:09 +00:00
Save a string allocation in expand_arguments_from_nodes
This function is called a lot; we can save a little bit of memory here.
This commit is contained in:
parent
9b3f4faa5a
commit
48c50d202b
1 changed files with 3 additions and 3 deletions
|
@ -930,13 +930,13 @@ end_execution_reason_t parse_execution_context_t::expand_arguments_from_nodes(
|
|||
completion_list_t arg_expanded;
|
||||
for (const ast::argument_t *arg_node : argument_nodes) {
|
||||
// Expect all arguments to have source.
|
||||
assert(arg_node->has_source());
|
||||
const wcstring arg_str = get_source(*arg_node);
|
||||
assert(arg_node->has_source() && "Argument should have source");
|
||||
|
||||
// Expand this string.
|
||||
parse_error_list_t errors;
|
||||
arg_expanded.clear();
|
||||
auto expand_ret = expand_string(arg_str, &arg_expanded, expand_flags_t{}, ctx, &errors);
|
||||
auto expand_ret =
|
||||
expand_string(get_source(*arg_node), &arg_expanded, expand_flags_t{}, ctx, &errors);
|
||||
parse_error_offset_source_start(&errors, arg_node->range.start);
|
||||
switch (expand_ret.result) {
|
||||
case expand_result_t::error: {
|
||||
|
|
Loading…
Reference in a new issue