Skip to content

Commit

Permalink
Use a reference for the return value of slurp(file)().
Browse files Browse the repository at this point in the history
Avoids an unnecessary and potentially expensive copy.
  • Loading branch information
paulhuggett committed Dec 13, 2023
1 parent d20866e commit 4c22d83
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/tree/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ int main (int argc, char const* argv[]) {
int exit_code = EXIT_SUCCESS;
try {
pjparser p = make_parser (peejay::dom{});
auto const res = argc < 2 ? slurp (p, std::cin) : slurp_file (p, argv[1]);
auto const& res = argc < 2 ? slurp (p, std::cin) : slurp_file (p, argv[1]);
if (std::holds_alternative<std::error_code> (res)) {
report_error (p, argc < 2 ? "<stdin>" : argv[1]);
exit_code = EXIT_FAILURE;
Expand Down

0 comments on commit 4c22d83

Please sign in to comment.