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/cares_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/cares_wrap.cc')
-rw-r--r-- | src/cares_wrap.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 3aab61e1b3..faa5f74e21 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -174,8 +174,7 @@ static void ares_poll_close_cb(uv_handle_t* watcher) { /* Allocates and returns a new node_ares_task */ static node_ares_task* ares_task_create(Environment* env, ares_socket_t sock) { - node_ares_task* task = - static_cast<node_ares_task*>(node::Malloc(sizeof(*task))); + auto task = node::Malloc<node_ares_task>(1); if (task == nullptr) { /* Out of memory. */ |