mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-01 07:38:46 +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;
|
completion_list_t arg_expanded;
|
||||||
for (const ast::argument_t *arg_node : argument_nodes) {
|
for (const ast::argument_t *arg_node : argument_nodes) {
|
||||||
// Expect all arguments to have source.
|
// Expect all arguments to have source.
|
||||||
assert(arg_node->has_source());
|
assert(arg_node->has_source() && "Argument should have source");
|
||||||
const wcstring arg_str = get_source(*arg_node);
|
|
||||||
|
|
||||||
// Expand this string.
|
// Expand this string.
|
||||||
parse_error_list_t errors;
|
parse_error_list_t errors;
|
||||||
arg_expanded.clear();
|
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);
|
parse_error_offset_source_start(&errors, arg_node->range.start);
|
||||||
switch (expand_ret.result) {
|
switch (expand_ret.result) {
|
||||||
case expand_result_t::error: {
|
case expand_result_t::error: {
|
||||||
|
|
Loading…
Reference in a new issue