Browse Source

Inline Buffer::HasInstance

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
1660db6b87
  1. 8
      src/node_buffer.cc
  2. 6
      src/node_buffer.h

8
src/node_buffer.cc

@ -339,14 +339,6 @@ Handle<Value> Buffer::Utf8ByteLength(const Arguments &args) {
} }
bool Buffer::HasInstance(Handle<Value> val) {
if (!val->IsObject()) return false;
Local<Object> obj = val->ToObject();
return constructor_template->HasInstance(obj);
}
void Buffer::Initialize(Handle<Object> target) { void Buffer::Initialize(Handle<Object> target) {
HandleScope scope; HandleScope scope;

6
src/node_buffer.h

@ -31,7 +31,11 @@ struct Blob_;
class Buffer : public ObjectWrap { class Buffer : public ObjectWrap {
public: public:
static void Initialize(v8::Handle<v8::Object> target); static void Initialize(v8::Handle<v8::Object> target);
static bool HasInstance(v8::Handle<v8::Value> val); static inline bool HasInstance(v8::Handle<v8::Value> val) {
if (!val->IsObject()) return false;
v8::Local<v8::Object> obj = val->ToObject();
return constructor_template->HasInstance(obj);
}
const char* data() const { return data_; } const char* data() const { return data_; }
size_t length() const { return length_; } size_t length() const { return length_; }

Loading…
Cancel
Save