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.
This commit is contained in:
parent
4ac6912a77
commit
ffc5d83568
@ -64,12 +64,14 @@ using v8::Value;
|
|||||||
class FSReqWrap: public ReqWrap<uv_fs_t> {
|
class FSReqWrap: public ReqWrap<uv_fs_t> {
|
||||||
public:
|
public:
|
||||||
explicit FSReqWrap(const char* syscall)
|
explicit FSReqWrap(const char* syscall)
|
||||||
: must_free_(false),
|
: must_free_(false)
|
||||||
syscall_(syscall) {
|
, data_(NULL)
|
||||||
|
, syscall_(syscall) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* syscall() { return syscall_; }
|
const char* syscall() { return syscall_; }
|
||||||
bool must_free_; // request is responsible for free'ing memory oncomplete
|
bool must_free_; // request is responsible for free'ing memory oncomplete
|
||||||
|
char* data_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* syscall_;
|
const char* syscall_;
|
||||||
@ -103,7 +105,7 @@ static void After(uv_fs_t *req) {
|
|||||||
|
|
||||||
// check if data needs to be cleaned
|
// check if data needs to be cleaned
|
||||||
if (req_wrap->must_free_ == true)
|
if (req_wrap->must_free_ == true)
|
||||||
delete[] static_cast<char*>(req_wrap->data_);
|
delete[] req_wrap->data_;
|
||||||
|
|
||||||
// there is always at least one argument. "error"
|
// there is always at least one argument. "error"
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
|
@ -74,7 +74,6 @@ class ReqWrap {
|
|||||||
|
|
||||||
v8::Persistent<v8::Object> object_;
|
v8::Persistent<v8::Object> object_;
|
||||||
QUEUE req_wrap_queue_;
|
QUEUE req_wrap_queue_;
|
||||||
void* data_;
|
|
||||||
T req_; // *must* be last, GetActiveRequests() in node.cc depends on it
|
T req_; // *must* be last, GetActiveRequests() in node.cc depends on it
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user