GeezerVison is showing github.com — src: rename Buffer::Use() to Buffer::New() · nodejs/node@455ec57
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/node_buffer.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -365,13 +365,13 @@ MaybeLocal<Object> New(Isolate* isolate, char* data, size_t length) { | 365 | 365 | Environment* env = Environment::GetCurrent(isolate); | 366 | 366 | EscapableHandleScope handle_scope(env->isolate()); | 367 | 367 | Local<Object> obj; | 368 | | - if (Buffer::Use(env, data, length).ToLocal(&obj)) | | 368 | + if (Buffer::New(env, data, length).ToLocal(&obj)) | 369 | 369 | return handle_scope.Escape(obj); | 370 | 370 | return Local<Object>(); | 371 | 371 | } | 372 | 372 |
| 373 | 373 |
| 374 | | -MaybeLocal<Object> Use(Environment* env, char* data, size_t length) { | | 374 | +MaybeLocal<Object> New(Environment* env, char* data, size_t length) { | 375 | 375 | EscapableHandleScope scope(env->isolate()); | 376 | 376 |
| 377 | 377 | if (length > 0) { | |
Collapse file Copy file name to clipboardExpand all lines: src/node_crypto.cc +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3004,7 +3004,7 @@ void CipherBase::GetAuthTag(const FunctionCallbackInfo<Value>& args) { | 3004 | 3004 | unsigned int out_len = 0; | 3005 | 3005 |
| 3006 | 3006 | 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(); | 3008 | 3008 | args.GetReturnValue().Set(buf); | 3009 | 3009 | } else { | 3010 | 3010 | env->ThrowError("Attempting to get auth tag in unsupported state"); | @@ -4479,7 +4479,7 @@ void ECDH::ComputeSecret(const FunctionCallbackInfo<Value>& args) { | 4479 | 4479 | return env->ThrowError("Failed to compute ECDH key"); | 4480 | 4480 | } | 4481 | 4481 |
| 4482 | | - Local<Object> buf = Buffer::Use(env, out, out_len).ToLocalChecked(); | | 4482 | + Local<Object> buf = Buffer::New(env, out, out_len).ToLocalChecked(); | 4483 | 4483 | args.GetReturnValue().Set(buf); | 4484 | 4484 | } | 4485 | 4485 |
| @@ -4517,7 +4517,7 @@ void ECDH::GetPublicKey(const FunctionCallbackInfo<Value>& args) { | 4517 | 4517 | } | 4518 | 4518 |
| 4519 | 4519 | Local<Object> buf = | 4520 | | - Buffer::Use(env, reinterpret_cast<char*>(out), size).ToLocalChecked(); | | 4520 | + Buffer::New(env, reinterpret_cast<char*>(out), size).ToLocalChecked(); | 4521 | 4521 | args.GetReturnValue().Set(buf); | 4522 | 4522 | } | 4523 | 4523 |
| @@ -4544,7 +4544,7 @@ void ECDH::GetPrivateKey(const FunctionCallbackInfo<Value>& args) { | 4544 | 4544 | } | 4545 | 4545 |
| 4546 | 4546 | Local<Object> buf = | 4547 | | - Buffer::Use(env, reinterpret_cast<char*>(out), size).ToLocalChecked(); | | 4547 | + Buffer::New(env, reinterpret_cast<char*>(out), size).ToLocalChecked(); | 4548 | 4548 | args.GetReturnValue().Set(buf); | 4549 | 4549 | } | 4550 | 4550 |
| @@ -4947,7 +4947,7 @@ void RandomBytesCheck(RandomBytesRequest* req, Local<Value> argv[2]) { | 4947 | 4947 | size_t size; | 4948 | 4948 | req->return_memory(&data, &size); | 4949 | 4949 | 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(); | 4951 | 4951 | } | 4952 | 4952 | } | 4953 | 4953 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_internals.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -284,7 +284,7 @@ v8::MaybeLocal<v8::Object> New(Environment* env, | 284 | 284 | // Takes ownership of |data|. Must allocate |data| with malloc() or realloc() | 285 | 285 | // because ArrayBufferAllocator::Free() deallocates it again with free(). | 286 | 286 | // 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); | 288 | 288 | } // namespace Buffer | 289 | 289 |
| 290 | 290 | } // namespace node | |
Collapse file Copy file name to clipboardExpand all lines: src/stream_wrap.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -223,7 +223,7 @@ void StreamWrap::OnReadImpl(ssize_t nread, | 223 | 223 | CHECK_EQ(pending, UV_UNKNOWN_HANDLE); | 224 | 224 | } | 225 | 225 |
| 226 | | - Local<Object> obj = Buffer::Use(env, base, nread).ToLocalChecked(); | | 226 | + Local<Object> obj = Buffer::New(env, base, nread).ToLocalChecked(); | 227 | 227 | wrap->EmitData(nread, obj, pending_obj); | 228 | 228 | } | 229 | 229 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/tls_wrap.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -660,7 +660,7 @@ void TLSWrap::OnReadSelf(ssize_t nread, | 660 | 660 | TLSWrap* wrap = static_cast<TLSWrap*>(ctx); | 661 | 661 | Local<Object> buf_obj; | 662 | 662 | 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(); | 664 | 664 | wrap->EmitData(nread, buf_obj, Local<Object>()); | 665 | 665 | } | 666 | 666 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/udp_wrap.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -408,7 +408,7 @@ void UDPWrap::OnRecv(uv_udp_t* handle, | 408 | 408 | } | 409 | 409 |
| 410 | 410 | 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(); | 412 | 412 | argv[3] = AddressToJS(env, addr); | 413 | 413 | wrap->MakeCallback(env->onmessage_string(), ARRAY_SIZE(argv), argv); | 414 | 414 | } | |
|