Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Inline Buffer::Length and Buffer::Data

  • Loading branch information...
commit 56074d1056a4e4b7a9954f18805605d79b0a5c3a 1 parent a936340
@ry ry authored
Showing with 7 additions and 16 deletions.
  1. +0 −14 src/node_buffer.cc
  2. +7 −2 src/node_buffer.h
View
14 src/node_buffer.cc
@@ -137,20 +137,6 @@ Buffer* Buffer::New(char *data, size_t length,
}
-char* Buffer::Data(Handle<Object> obj) {
- if (Buffer::HasInstance(obj))
- return (char*)obj->GetIndexedPropertiesExternalArrayData();
- return NULL;
-}
-
-
-size_t Buffer::Length(Handle<Object> obj) {
- if (Buffer::HasInstance(obj))
- return (size_t)obj->GetIndexedPropertiesExternalArrayDataLength();
- return 0;
-}
-
-
Handle<Value> Buffer::New(const Arguments &args) {
if (!args.IsConstructCall()) {
return FromConstructorTemplate(constructor_template, args);
View
9 src/node_buffer.h
@@ -36,8 +36,13 @@ class Buffer : public ObjectWrap {
free_callback callback, void *hint); // public constructor
static bool HasInstance(v8::Handle<v8::Value> val);
- static char* Data(v8::Handle<v8::Object>);
- static size_t Length(v8::Handle<v8::Object>);
+ static inline char* Data(v8::Handle<v8::Object> obj) {
+ return (char*)obj->GetIndexedPropertiesExternalArrayData();
+ }
+
+ static inline size_t Length(v8::Handle<v8::Object> obj) {
+ return (size_t)obj->GetIndexedPropertiesExternalArrayDataLength();
+ }
private:
static v8::Persistent<v8::FunctionTemplate> constructor_template;
Please sign in to comment.
Something went wrong with that request. Please try again.