Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-11-20 11:04:22 +0300
committerRyan Dahl <ry@tinyclouds.org>2010-11-20 11:04:22 +0300
commit56074d1056a4e4b7a9954f18805605d79b0a5c3a (patch)
treeb409bbaaf9873703f87903f78a36279830458be1 /src
parenta93634007a0c5366d415782c2a1f164a6d7ecbc5 (diff)
Inline Buffer::Length and Buffer::Data
Diffstat (limited to 'src')
-rw-r--r--src/node_buffer.cc14
-rw-r--r--src/node_buffer.h9
2 files changed, 7 insertions, 16 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index d95cf515ee4..00a66764d20 100644
--- a/src/node_buffer.cc
+++ b/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);
diff --git a/src/node_buffer.h b/src/node_buffer.h
index 34b353d799a..fa39b1e41bd 100644
--- a/src/node_buffer.h
+++ b/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;