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:
Ben Noordhuis 2013-08-13 11:56:44 +02:00
parent 4ac6912a77
commit ffc5d83568
2 changed files with 5 additions and 4 deletions

View File

@ -64,12 +64,14 @@ using v8::Value;
class FSReqWrap: public ReqWrap<uv_fs_t> {
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<char*>(req_wrap->data_);
delete[] req_wrap->data_;
// there is always at least one argument. "error"
int argc = 1;

View File

@ -74,7 +74,6 @@ class ReqWrap {
v8::Persistent<v8::Object> object_;
QUEUE req_wrap_queue_;
void* data_;
T req_; // *must* be last, GetActiveRequests() in node.cc depends on it
};