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 455ec57

Browse filesBrowse files
bnoordhuisrvagg
authored andcommitted
src: rename Buffer::Use() to Buffer::New()
Fixes: #2308 PR-URL: #2352 Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1 parent fd63e1c commit 455ec57
Copy full SHA for 455ec57

File tree

Expand file treeCollapse file tree

6 files changed

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

6 files changed

+11
-11
lines changed
Open diff view settings
Collapse file

‎src/node_buffer.cc‎

Copy file name to clipboardExpand all lines: src/node_buffer.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,13 @@ MaybeLocal<Object> New(Isolate* isolate, char* data, size_t length) {
365365
Environment* env = Environment::GetCurrent(isolate);
366366
EscapableHandleScope handle_scope(env->isolate());
367367
Local<Object> obj;
368-
if (Buffer::Use(env, data, length).ToLocal(&obj))
368+
if (Buffer::New(env, data, length).ToLocal(&obj))
369369
return handle_scope.Escape(obj);
370370
return Local<Object>();
371371
}
372372

373373

374-
MaybeLocal<Object> Use(Environment* env, char* data, size_t length) {
374+
MaybeLocal<Object> New(Environment* env, char* data, size_t length) {
375375
EscapableHandleScope scope(env->isolate());
376376

377377
if (length > 0) {
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3004,7 +3004,7 @@ void CipherBase::GetAuthTag(const FunctionCallbackInfo<Value>& args) {
30043004
unsigned int out_len = 0;
30053005

30063006
if (cipher->GetAuthTag(&out, &out_len)) {
3007-
Local<Object> buf = Buffer::Use(env, out, out_len).ToLocalChecked();
3007+
Local<Object> buf = Buffer::New(env, out, out_len).ToLocalChecked();
30083008
args.GetReturnValue().Set(buf);
30093009
} else {
30103010
env->ThrowError("Attempting to get auth tag in unsupported state");
@@ -4479,7 +4479,7 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo<Value>& args) {
44794479
return env->ThrowError("Failed to compute ECDH key");
44804480
}
44814481

4482-
Local<Object> buf = Buffer::Use(env, out, out_len).ToLocalChecked();
4482+
Local<Object> buf = Buffer::New(env, out, out_len).ToLocalChecked();
44834483
args.GetReturnValue().Set(buf);
44844484
}
44854485

@@ -4517,7 +4517,7 @@ void ECDH::GetPublicKey(const FunctionCallbackInfo<Value>& args) {
45174517
}
45184518

45194519
Local<Object> buf =
4520-
Buffer::Use(env, reinterpret_cast<char*>(out), size).ToLocalChecked();
4520+
Buffer::New(env, reinterpret_cast<char*>(out), size).ToLocalChecked();
45214521
args.GetReturnValue().Set(buf);
45224522
}
45234523

@@ -4544,7 +4544,7 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo<Value>& args) {
45444544
}
45454545

45464546
Local<Object> buf =
4547-
Buffer::Use(env, reinterpret_cast<char*>(out), size).ToLocalChecked();
4547+
Buffer::New(env, reinterpret_cast<char*>(out), size).ToLocalChecked();
45484548
args.GetReturnValue().Set(buf);
45494549
}
45504550

@@ -4947,7 +4947,7 @@ void RandomBytesCheck(RandomBytesRequest* req, Local<Value> argv[2]) {
49474947
size_t size;
49484948
req->return_memory(&data, &size);
49494949
argv[0] = Null(req->env()->isolate());
4950-
argv[1] = Buffer::Use(req->env(), data, size).ToLocalChecked();
4950+
argv[1] = Buffer::New(req->env(), data, size).ToLocalChecked();
49514951
}
49524952
}
49534953

Collapse file

‎src/node_internals.h‎

Copy file name to clipboardExpand all lines: src/node_internals.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ v8::MaybeLocal<v8::Object> New(Environment* env,
284284
// Takes ownership of |data|. Must allocate |data| with malloc() or realloc()
285285
// because ArrayBufferAllocator::Free() deallocates it again with free().
286286
// Mixing operator new and free() is undefined behavior so don't do that.
287-
v8::MaybeLocal<v8::Object> Use(Environment* env, char* data, size_t length);
287+
v8::MaybeLocal<v8::Object> New(Environment* env, char* data, size_t length);
288288
} // namespace Buffer
289289

290290
} // namespace node
Collapse file

‎src/stream_wrap.cc‎

Copy file name to clipboardExpand all lines: src/stream_wrap.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void StreamWrap::OnReadImpl(ssize_t nread,
223223
CHECK_EQ(pending, UV_UNKNOWN_HANDLE);
224224
}
225225

226-
Local<Object> obj = Buffer::Use(env, base, nread).ToLocalChecked();
226+
Local<Object> obj = Buffer::New(env, base, nread).ToLocalChecked();
227227
wrap->EmitData(nread, obj, pending_obj);
228228
}
229229

Collapse file

‎src/tls_wrap.cc‎

Copy file name to clipboardExpand all lines: src/tls_wrap.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ void TLSWrap::OnReadSelf(ssize_t nread,
660660
TLSWrap* wrap = static_cast<TLSWrap*>(ctx);
661661
Local<Object> buf_obj;
662662
if (buf != nullptr)
663-
buf_obj = Buffer::Use(wrap->env(), buf->base, buf->len).ToLocalChecked();
663+
buf_obj = Buffer::New(wrap->env(), buf->base, buf->len).ToLocalChecked();
664664
wrap->EmitData(nread, buf_obj, Local<Object>());
665665
}
666666

Collapse file

‎src/udp_wrap.cc‎

Copy file name to clipboardExpand all lines: src/udp_wrap.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
408408
}
409409

410410
char* base = static_cast<char*>(realloc(buf->base, nread));
411-
argv[2] = Buffer::Use(env, base, nread).ToLocalChecked();
411+
argv[2] = Buffer::New(env, base, nread).ToLocalChecked();
412412
argv[3] = AddressToJS(env, addr);
413413
wrap->MakeCallback(env->onmessage_string(), ARRAY_SIZE(argv), argv);
414414
}

0 commit comments

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