From: Ben Noordhuis Date: Tue, 13 Aug 2013 09:56:44 +0000 (+0200) Subject: src: move ReqWrap::data_ to FSReqWrap X-Git-Tag: v0.11.6~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ffc5d83568cc9ff694c6461aaa9dfc70545bf23c;p=platform%2Fupstream%2Fnodejs.git src: move ReqWrap::data_ to FSReqWrap FSReqWrap is the only ReqWrap child class that uses the data_ field so move it out of ReqWrap and into FSReqWrap. --- diff --git a/src/node_file.cc b/src/node_file.cc index e01c5bd..856661f 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -64,12 +64,14 @@ using v8::Value; class FSReqWrap: public ReqWrap { public: explicit FSReqWrap(const char* syscall) - : must_free_(false), - syscall_(syscall) { + : must_free_(false) + , data_(NULL) + , syscall_(syscall) { } const char* syscall() { return syscall_; } bool must_free_; // request is responsible for free'ing memory oncomplete + char* data_; private: const char* syscall_; @@ -103,7 +105,7 @@ static void After(uv_fs_t *req) { // check if data needs to be cleaned if (req_wrap->must_free_ == true) - delete[] static_cast(req_wrap->data_); + delete[] req_wrap->data_; // there is always at least one argument. "error" int argc = 1; diff --git a/src/req_wrap.h b/src/req_wrap.h index 1187df9..44749a3 100644 --- a/src/req_wrap.h +++ b/src/req_wrap.h @@ -74,7 +74,6 @@ class ReqWrap { v8::Persistent object_; QUEUE req_wrap_queue_; - void* data_; T req_; // *must* be last, GetActiveRequests() in node.cc depends on it };