diff options
author | Anna Henningsen <anna@addaleax.net> | 2016-09-10 17:50:02 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-09-29 09:46:42 +0200 |
commit | 48ed65440ca33fe6063d92379b3a9b10b65e98e9 (patch) | |
tree | b0fbfa17238c7d00839b92f3712e39c468c77c0a /src/udp_wrap.cc | |
parent | eb927fac38a50252e11ebe0da1764e85294f95f0 (diff) | |
download | android-node-v8-48ed65440ca33fe6063d92379b3a9b10b65e98e9.tar.gz android-node-v8-48ed65440ca33fe6063d92379b3a9b10b65e98e9.tar.bz2 android-node-v8-48ed65440ca33fe6063d92379b3a9b10b65e98e9.zip |
src: pass desired return type to allocators
Pass the desired return type directly to the allocation functions,
so that the resulting `static_cast` from `void*` becomes unneccessary
and the return type can be use as a reasonable default value for the
`size` parameter.
PR-URL: https://github.com/nodejs/node/pull/8482
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Diffstat (limited to 'src/udp_wrap.cc')
-rw-r--r-- | src/udp_wrap.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index c8009a5276..bbd30a5266 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -374,7 +374,7 @@ void UDPWrap::OnSend(uv_udp_send_t* req, int status) { void UDPWrap::OnAlloc(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) { - buf->base = static_cast<char*>(node::Malloc(suggested_size)); + buf->base = node::Malloc(suggested_size); buf->len = suggested_size; if (buf->base == nullptr && suggested_size > 0) { @@ -416,7 +416,7 @@ void UDPWrap::OnRecv(uv_udp_t* handle, return; } - char* base = static_cast<char*>(node::Realloc(buf->base, nread)); + char* base = node::Realloc(buf->base, nread); argv[2] = Buffer::New(env, base, nread).ToLocalChecked(); argv[3] = AddressToJS(env, addr); wrap->MakeCallback(env->onmessage_string(), arraysize(argv), argv); |