Browse Source

smalloc: fix style, use macro

v0.11.4-release
Fedor Indutny 12 years ago
parent
commit
28609d1779
  1. 21
      src/smalloc.cc

21
src/smalloc.cc

@ -32,7 +32,6 @@
#define ALLOC_ID (0xA10C) #define ALLOC_ID (0xA10C)
namespace node { namespace node {
namespace smalloc { namespace smalloc {
using v8::Arguments; using v8::Arguments;
@ -247,7 +246,8 @@ void TargetFreeCallback(Isolate* isolate,
class RetainedAllocInfo: public RetainedObjectInfo { class RetainedAllocInfo: public RetainedObjectInfo {
public: public:
RetainedAllocInfo(Handle<Value> wrapper); explicit RetainedAllocInfo(Handle<Value> wrapper);
virtual void Dispose(); virtual void Dispose();
virtual bool IsEquivalent(RetainedObjectInfo* other); virtual bool IsEquivalent(RetainedObjectInfo* other);
virtual intptr_t GetHash(); virtual intptr_t GetHash();
@ -255,13 +255,13 @@ public:
virtual intptr_t GetSizeInBytes(); virtual intptr_t GetSizeInBytes();
private: private:
static const char label_[]; static const char* label_;
char* data_; char* data_;
int length_; int length_;
}; };
const char RetainedAllocInfo::label_[] = "smalloc"; const char* RetainedAllocInfo::label_ = "smalloc";
RetainedAllocInfo::RetainedAllocInfo(Handle<Value> wrapper) { RetainedAllocInfo::RetainedAllocInfo(Handle<Value> wrapper) {
@ -303,15 +303,11 @@ RetainedObjectInfo* WrapperInfo(uint16_t class_id, Handle<Value> wrapper) {
void Initialize(Handle<Object> exports) { void Initialize(Handle<Object> exports) {
exports->Set(String::New("copyOnto"), NODE_SET_METHOD(exports, "copyOnto", CopyOnto);
FunctionTemplate::New(CopyOnto)->GetFunction()); NODE_SET_METHOD(exports, "sliceOnto", SliceOnto);
exports->Set(String::New("sliceOnto"),
FunctionTemplate::New(SliceOnto)->GetFunction());
exports->Set(String::New("alloc"), NODE_SET_METHOD(exports, "alloc", Alloc);
FunctionTemplate::New(Alloc)->GetFunction()); NODE_SET_METHOD(exports, "dispose", AllocDispose);
exports->Set(String::New("dispose"),
FunctionTemplate::New(AllocDispose)->GetFunction());
exports->Set(String::New("kMaxLength"), exports->Set(String::New("kMaxLength"),
Uint32::New(kMaxLength, node_isolate)); Uint32::New(kMaxLength, node_isolate));
@ -325,7 +321,6 @@ void Initialize(Handle<Object> exports) {
} // namespace smalloc } // namespace smalloc
} // namespace node } // namespace node
NODE_MODULE(node_smalloc, node::smalloc::Initialize) NODE_MODULE(node_smalloc, node::smalloc::Initialize)

Loading…
Cancel
Save