Browse Source

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.
v0.11.6-release
Ben Noordhuis 12 years ago
parent
commit
ffc5d83568
  1. 8
      src/node_file.cc
  2. 1
      src/req_wrap.h

8
src/node_file.cc

@ -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;

1
src/req_wrap.h

@ -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
};

Loading…
Cancel
Save