Skip to content

Commit ffc5d83

Browse files
committed
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.
1 parent 4ac6912 commit ffc5d83

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/node_file.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,14 @@ using v8::Value;
6464
class FSReqWrap: public ReqWrap<uv_fs_t> {
6565
public:
6666
explicit FSReqWrap(const char* syscall)
67-
: must_free_(false),
68-
syscall_(syscall) {
67+
: must_free_(false)
68+
, data_(NULL)
69+
, syscall_(syscall) {
6970
}
7071

7172
const char* syscall() { return syscall_; }
7273
bool must_free_; // request is responsible for free'ing memory oncomplete
74+
char* data_;
7375

7476
private:
7577
const char* syscall_;
@@ -103,7 +105,7 @@ static void After(uv_fs_t *req) {
103105

104106
// check if data needs to be cleaned
105107
if (req_wrap->must_free_ == true)
106-
delete[] static_cast<char*>(req_wrap->data_);
108+
delete[] req_wrap->data_;
107109

108110
// there is always at least one argument. "error"
109111
int argc = 1;

src/req_wrap.h

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class ReqWrap {
7474

7575
v8::Persistent<v8::Object> object_;
7676
QUEUE req_wrap_queue_;
77-
void* data_;
7877
T req_; // *must* be last, GetActiveRequests() in node.cc depends on it
7978
};
8079

0 commit comments

Comments
 (0)