Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 00ed7d1

Browse filesBrowse files
addaleaxBridgeAR
authored andcommitted
src: inline SLICE_START_END() in node_buffer.cc
This macro is only used once, so it doesn’t need to be a macro. PR-URL: #29357 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Masashi Hirano <shisama07@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 1dc5ded commit 00ed7d1
Copy full SHA for 00ed7d1

File tree

Expand file treeCollapse file tree

1 file changed

+7
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-10
lines changed
Open diff view settings
Collapse file

‎src/node_buffer.cc‎

Copy file name to clipboardExpand all lines: src/node_buffer.cc
+7-10Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@
4444
return node::THROW_ERR_OUT_OF_RANGE(env, "Index out of range"); \
4545
} while (0) \
4646

47-
#define SLICE_START_END(env, start_arg, end_arg, end_max) \
48-
size_t start = 0; \
49-
size_t end = 0; \
50-
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, start_arg, 0, &start)); \
51-
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, end_arg, end_max, &end)); \
52-
if (end < start) end = start; \
53-
THROW_AND_RETURN_IF_OOB(Just(end <= end_max)); \
54-
size_t length = end - start;
55-
5647
namespace node {
5748
namespace Buffer {
5849

@@ -467,7 +458,13 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
467458
if (buffer.length() == 0)
468459
return args.GetReturnValue().SetEmptyString();
469460

470-
SLICE_START_END(env, args[0], args[1], buffer.length())
461+
size_t start = 0;
462+
size_t end = 0;
463+
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[0], 0, &start));
464+
THROW_AND_RETURN_IF_OOB(ParseArrayIndex(env, args[1], buffer.length(), &end));
465+
if (end < start) end = start;
466+
THROW_AND_RETURN_IF_OOB(Just(end <= buffer.length()));
467+
size_t length = end - start;
471468

472469
Local<Value> error;
473470
MaybeLocal<Value> ret =

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.