Skip to content

Conversation

@Yuhanun
Copy link

@YuhanunYuhanun commented Feb 5, 2020

  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows [commit guidelines]

A simple first contribution.

std::unique_ptr's constructor can lead to memory leaks if the constructed value, allocated through new, throws an exception or something that causes an immediate backtrace on the callstack.

std::make_unique prevents this by allocating the memory for you, making it safer. Not only does it make it safer, it also makes it more readable.

I'm not sure whether I followed every guideline with this, but I hope I did.

@nodejs-github-botnodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Feb 5, 2020
@YuhanunYuhanun changed the title Modernized unique_ptr constructionsrc: Modernized unique_ptr constructionFeb 5, 2020
Copy link
Member

@addaleaxaddaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Just as a side note, exceptions aren’t enabled in the Node.js source tree :)

jasnell
jasnell previously approved these changes Feb 5, 2020
@Yuhanun
Copy link
Author

LGTM

Just as a side note, exceptions aren’t enabled in the Node.js source tree :)

Ah okay, well my bad for that :) Didn't know that, good to know though since I'm looking to make more contributions to the project :)

@addaleax
Copy link
Member

@Yuhanun It’s all good – like you said, it also makes the code more readable. 👍

@jasnelljasnell dismissed their stale reviewFebruary 6, 2020 15:12

One of the changes needs fixing

Copy link
Member

@jasnelljasnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs @TimothyGu's suggestion added

@addaleaxaddaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 6, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@addaleax
Copy link
Member

Landed in 9c753b3, thanks for the PR! 🎉

@addaleaxaddaleax closed this Feb 8, 2020
addaleax pushed a commit that referenced this pull request Feb 8, 2020
PR-URL: #31654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
codebytere pushed a commit that referenced this pull request Feb 17, 2020
PR-URL: #31654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
@codebyterecodebytere mentioned this pull request Feb 17, 2020
codebytere pushed a commit that referenced this pull request Mar 15, 2020
PR-URL: #31654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
codebytere pushed a commit that referenced this pull request Mar 17, 2020
PR-URL: #31654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
@codebyterecodebytere mentioned this pull request Mar 17, 2020
codebytere pushed a commit that referenced this pull request Mar 30, 2020
PR-URL: #31654 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.c++Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@Yuhanun@addaleax@nodejs-github-bot@fhinkel@jasnell@TimothyGu@cjihrig@devnexen@devsnek