Skip to content

Commit

Permalink
Use const reference parameters for efficiency to not make copies
Browse files Browse the repository at this point in the history
Flagged by Coverity Scan.
  • Loading branch information
eldering committed Jan 16, 2024
1 parent e823d7d commit ece4b28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion judge/runpipe.cc
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ int main(int argc, char **argv) {
}

// The exit status should match the one of the first command.
auto main_process = state.main_process();
auto &main_process = state.main_process();
int exit_code = main_process.exit_code();
if (exit_code != -1) {
return exit_code;
Expand Down
2 changes: 1 addition & 1 deletion sql/files/defaultdata/compare/compare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ bool equal_case_insensitive(std::string a, std::string b)
/* Test two floating-point numbers for equality, accounting for +/-INF, NaN, and precision.
* Float `jval` is considered the reference value for relative error.
*/
void compare_float(std::string judge, std::string team, flt jval, flt tval, flt float_abs_tol, flt float_rel_tol, std::string extra_msg) {
void compare_float(const std::string &judge, const std::string &team, flt jval, flt tval, flt float_abs_tol, flt float_rel_tol, const std::string &extra_msg) {
/* Finite values are compared with some tolerance */
if (std::isfinite(tval) && std::isfinite(jval)) {
flt absdiff = fabsl(tval-jval);
Expand Down

0 comments on commit ece4b28

Please sign in to comment.