FSReqWrap is the only ReqWrap child class that uses the data_ field so
move it out of ReqWrap and into FSReqWrap.
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_;
// 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;
v8::Persistent<v8::Object> object_;
QUEUE req_wrap_queue_;
- void* data_;
T req_; // *must* be last, GetActiveRequests() in node.cc depends on it
};