Skip to content

Conversation

@mhdawson
Copy link
Member

  • reduce copying by using std::move

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. vm Issues and PRs related to the vm subsystem. labels Nov 21, 2023
@mhdawson
Copy link
MemberAuthor

mhdawson commented Nov 21, 2023

Coverity warning

 std::vector<Local<String>> params ={1464String::NewFromUtf8(isolate, "exports").ToLocalChecked(), 1465String::NewFromUtf8(isolate, "require").ToLocalChecked(), 1466String::NewFromUtf8(isolate, "module").ToLocalChecked(), 1467String::NewFromUtf8(isolate, "__filename").ToLocalChecked(), 1468String::NewFromUtf8(isolate, "__dirname").ToLocalChecked()}; 14691470 TryCatchScope try_catch(env); 14711472ContextifyContext::CompileFunctionAndCacheResult(env, 1473 context, 1474 &source, CID 329955 (#1 of 1): COPY_INSTEAD_OF_MOVE (COPY_INSTEAD_OF_MOVE) 1. copy_constructor_call: params is passed-by-value as parameter to CompileFunctionAndCacheResult when it could be moved instead. Use std::move(params) instead of params. 1475 params, 1476 std::vector<Local<Object>>(), 1477 options, 1478 true, 1479 id_symbol, 1480 try_catch);

I think the suggested std::move will avoid copying the contents of the vector.

@tniessen
Copy link
Member

Nit: duplicate word in commit message

- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]>
@mhdawson
Copy link
MemberAuthor

mhdawson commented Nov 22, 2023

@tniessen thanks, fixed commit message.

@mhdawsonmhdawson added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 22, 2023
@github-actionsgithub-actionsbot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 22, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@lpincalpinca added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 24, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 24, 2023
@nodejs-github-botnodejs-github-bot merged commit 6dbf678 into nodejs:mainNov 24, 2023
@nodejs-github-bot
Copy link
Collaborator

Landed in 6dbf678

martenrichter pushed a commit to martenrichter/node that referenced this pull request Nov 26, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: nodejs#50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
lucshi pushed a commit to lucshi/node that referenced this pull request Nov 27, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: nodejs#50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Nov 27, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: #50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
@RafaelGSSRafaelGSS mentioned this pull request Nov 28, 2023
RafaelGSS pushed a commit that referenced this pull request Nov 29, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: #50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
RafaelGSS pushed a commit that referenced this pull request Nov 30, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: #50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
UlisesGascon pushed a commit that referenced this pull request Dec 11, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: #50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
@UlisesGasconUlisesGascon mentioned this pull request Dec 12, 2023
UlisesGascon pushed a commit that referenced this pull request Dec 13, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: #50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
UlisesGascon pushed a commit that referenced this pull request Dec 15, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: #50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
UlisesGascon pushed a commit that referenced this pull request Dec 19, 2023
- reduce copying by using std::move Signed-off-by: Michael Dawson <[email protected]> PR-URL: #50846 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.vmIssues and PRs related to the vm subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@mhdawson@tniessen@nodejs-github-bot@jasnell@lpinca@marco-ippolito