Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: refactor macro to std::min in node_buffer.cc #25919

Closed
wants to merge 1 commit into from

Conversation

gengjiawen
Copy link
Member

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

@nodejs-github-bot nodejs-github-bot added buffer Issues and PRs related to the buffer subsystem. c++ Issues and PRs that require attention from people who are familiar with C++. labels Feb 4, 2019
@addaleax
Copy link
Member

addaleax commented Feb 4, 2019

We use std::min elsewhere in our code, maybe it’s best to just replace the macro usage with that?

@gengjiawen
Copy link
Member Author

@addaleax I will give it a try.

@gengjiawen gengjiawen force-pushed the fix_macro_define branch 2 times, most recently from 04407e9 to 57b2d35 Compare February 4, 2019 10:35
@gengjiawen gengjiawen changed the title src: avoid macro re-define in node_buffer.cc src: refactor macro to std::min in node_buffer.cc Feb 4, 2019
src/node_buffer.cc Outdated Show resolved Hide resolved
@refack
Copy link
Contributor

refack commented Feb 4, 2019

src/node_buffer.cc Outdated Show resolved Hide resolved
@gengjiawen
Copy link
Member Author

Since we can't now format the whole file, I run into some issue on windows wsl:

Formatting C++ diff from HEAD..
  File "tools/clang-format/node_modules/.bin/git-clang-format", line 2
    basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
            ^
SyntaxError: invalid syntax
Makefile:1254: recipe for target 'format-cpp' failed
make: *** [format-cpp] Error 1

@addaleax
Copy link
Member

addaleax commented Feb 9, 2019

@gengjiawen That is npm trying to work around the lack of symlinks on Windows…

If you look at the definition of format-cpp in the Makefile, I think you might be able to resolve this by replacing .bin/git-clang-format and .bin/clang-format with their respective targets (clang-format/bin/git-clang-format and clang-format/index.js)?

@gengjiawen
Copy link
Member Author

gengjiawen commented Feb 9, 2019

@addaleax Thanks. I already clang-format the whole file. revert unrelated change. Easier when I get help from CLion :)

@gengjiawen
Copy link
Member Author

In the long run we should will try to make it more easier as described in #25908. I will try to invest more on this recently.

@addaleax
Copy link
Member

addaleax commented Feb 9, 2019

Landed in 2fa6376

@addaleax addaleax closed this Feb 9, 2019
addaleax pushed a commit that referenced this pull request Feb 9, 2019
PR-URL: #25919
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
targos pushed a commit that referenced this pull request Feb 10, 2019
PR-URL: #25919
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
@targos targos mentioned this pull request Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. 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