Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated to use scope.Close everywhere fixes #19

  • Loading branch information...
commit 9cd642e9995d899a65a9b384fd8384059d3dc400 1 parent 06b8da9
@tbranyen tbranyen authored
View
3  Makefile
@@ -17,6 +17,9 @@ config:
build:
@@$(NODE_BLD) build
+debug:
+ @@$(NODE_BLD) debug
+
install:
@@mkdir -p $(INSTALL_PATH)
@@mkdir -p $(INSTALL_PATH)/build/default
View
2  include/oid.h
@@ -24,7 +24,7 @@ class GitOid : public EventEmitter {
int Mkstr(const char* str);
void Mkraw(const unsigned char* raw);
- char* Fmt(char* buffer);
+ void Fmt(char* buffer);
void PathFmt(char *str);
char* AllocFmt();
char* ToString(char* buffer, size_t bufferSize);
View
24 src/commit.cc
@@ -143,7 +143,7 @@ Handle<Value> GitCommit::Lookup(const Arguments& args) {
eio_custom(EIO_Lookup, EIO_PRI_DEFAULT, EIO_AfterLookup, ar);
ev_ref(EV_DEFAULT_UC);
- return Undefined();
+ return scope.Close( Undefined() );
}
int GitCommit::EIO_Lookup(eio_req *req) {
@@ -185,7 +185,7 @@ Handle<Value> GitCommit::Close(const Arguments& args) {
GitCommit *commit = ObjectWrap::Unwrap<GitCommit>(args.This());
commit->Close();
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitCommit::Id(const Arguments& args) {
@@ -201,7 +201,7 @@ Handle<Value> GitCommit::Id(const Arguments& args) {
oid->SetValue(*const_cast<git_oid *>(commit->Id()));
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitCommit::MessageShort(const Arguments& args) {
@@ -209,7 +209,7 @@ Handle<Value> GitCommit::MessageShort(const Arguments& args) {
GitCommit *commit = ObjectWrap::Unwrap<GitCommit>(args.This());
- return String::New(commit->MessageShort());
+ return scope.Close( String::New(commit->MessageShort()) );
}
Handle<Value> GitCommit::Message(const Arguments& args) {
@@ -217,7 +217,7 @@ Handle<Value> GitCommit::Message(const Arguments& args) {
GitCommit *commit = ObjectWrap::Unwrap<GitCommit>(args.This());
- return String::New(commit->Message());
+ return scope.Close( String::New(commit->Message()) );
}
Handle<Value> GitCommit::Time(const Arguments& args) {
@@ -225,7 +225,7 @@ Handle<Value> GitCommit::Time(const Arguments& args) {
GitCommit *commit = ObjectWrap::Unwrap<GitCommit>(args.This());
- return Integer::New(commit->Time());
+ return scope.Close( Integer::New(commit->Time()) );
}
Handle<Value> GitCommit::TimeOffset(const Arguments& args) {
@@ -233,7 +233,7 @@ Handle<Value> GitCommit::TimeOffset(const Arguments& args) {
GitCommit *commit = ObjectWrap::Unwrap<GitCommit>(args.This());
- return Integer::New(commit->TimeOffset());
+ return scope.Close( Integer::New(commit->TimeOffset()) );
}
Handle<Value> GitCommit::Committer(const Arguments& args) {
@@ -249,7 +249,7 @@ Handle<Value> GitCommit::Committer(const Arguments& args) {
sig->SetValue(const_cast<git_signature *>(commit->Committer()));
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitCommit::Author(const Arguments& args) {
@@ -265,7 +265,7 @@ Handle<Value> GitCommit::Author(const Arguments& args) {
sig->SetValue(const_cast<git_signature *>(commit->Author()));
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitCommit::Tree(const Arguments& args) {
@@ -283,7 +283,7 @@ Handle<Value> GitCommit::Tree(const Arguments& args) {
int err = commit->Tree(&tree);
g_tree->SetValue(tree);
- return scope.Close(Integer::New(err));
+ return scope.Close( Integer::New(err) );
}
Handle<Value> GitCommit::ParentCount(const Arguments& args) {
@@ -293,7 +293,7 @@ Handle<Value> GitCommit::ParentCount(const Arguments& args) {
unsigned int count = commit->ParentCount();
- return Integer::New(count);
+ return scope.Close( Integer::New(count) );
}
Handle<Value> GitCommit::Parent(const Arguments& args) {
@@ -316,7 +316,7 @@ Handle<Value> GitCommit::Parent(const Arguments& args) {
int err = commit->Parent(&in, index);
out->SetValue(in);
- return Integer::New(err);
+ return scope.Close( Integer::New(err) );
}
Persistent<FunctionTemplate> GitCommit::constructor_template;
View
8 src/error.cc
@@ -38,21 +38,21 @@ Handle<Value> GitError::New(const Arguments& args) {
GitError *error = new GitError();
error->Wrap(args.This());
- return args.This();
+ return scope.Close( args.This() );
}
Handle<Value> GitError::StrError(const Arguments& args) {
- GitError* error = ObjectWrap::Unwrap<GitError>(args.This());
-
HandleScope scope;
+ GitError* error = ObjectWrap::Unwrap<GitError>(args.This());
+
if(args.Length() == 0 || !args[0]->IsNumber()) {
return ThrowException(Exception::Error(String::New("Error is required and must be a Number.")));
}
Local<Integer> err = Local<Integer>::Cast(args[0]);
- return String::New(error->StrError(err->Value()));
+ return scope.Close( String::New(error->StrError(err->Value())) );
}
Persistent<FunctionTemplate> GitError::constructor_template;
View
16 src/object.cc
@@ -93,7 +93,7 @@ Handle<Value> GitObject::New(const Arguments& args) {
obj->Wrap(args.This());
- return args.This();
+ return scope.Close( args.This() );
}
Handle<Value> GitObject::Id(const Arguments& args) {
@@ -109,7 +109,7 @@ Handle<Value> GitObject::Id(const Arguments& args) {
oid->SetValue(*const_cast<git_oid *>(obj->Id()));
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitObject::Type(const Arguments& args) {
@@ -117,7 +117,7 @@ Handle<Value> GitObject::Type(const Arguments& args) {
GitObject *obj = ObjectWrap::Unwrap<GitObject>(args.This());
- return Integer::New(obj->Type());
+ return scope.Close( Integer::New(obj->Type()) );
}
Handle<Value> GitObject::Owner(const Arguments& args) {
@@ -133,7 +133,7 @@ Handle<Value> GitObject::Owner(const Arguments& args) {
repo->SetValue(obj->Owner());
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitObject::Type2String(const Arguments& args) {
@@ -147,7 +147,7 @@ Handle<Value> GitObject::Type2String(const Arguments& args) {
git_otype type = (git_otype)args[0]->ToInteger()->Value();
- return String::New(obj->Type2String(type));
+ return scope.Close( String::New(obj->Type2String(type)) );
}
Handle<Value> GitObject::String2Type(const Arguments& args) {
@@ -161,7 +161,7 @@ Handle<Value> GitObject::String2Type(const Arguments& args) {
String::Utf8Value type(args[0]);
- return Integer::New(obj->String2Type(*type));
+ return scope.Close( Integer::New(obj->String2Type(*type)) );
}
Handle<Value> GitObject::TypeIsLoose(const Arguments& args) {
@@ -175,7 +175,7 @@ Handle<Value> GitObject::TypeIsLoose(const Arguments& args) {
git_otype type = (git_otype)args[0]->ToInteger()->Value();
- return Integer::New(obj->TypeIsLoose(type));
+ return scope.Close( Integer::New(obj->TypeIsLoose(type)) );
}
Handle<Value> GitObject::Size(const Arguments& args) {
@@ -189,7 +189,7 @@ Handle<Value> GitObject::Size(const Arguments& args) {
git_otype type = (git_otype)args[0]->ToInteger()->Value();
- return Integer::New(obj->Size(type));
+ return scope.Close( Integer::New(obj->Size(type)) );
}
Persistent<FunctionTemplate> GitObject::constructor_template;
View
43 src/oid.cc
@@ -50,7 +50,7 @@ void GitOid::Mkraw(const unsigned char* raw) {
git_oid_mkraw(&this->oid, raw);
}
-char* GitOid::Fmt(char* buffer) {
+void GitOid::Fmt(char* buffer) {
git_oid_fmt(buffer, &this->oid);
}
@@ -98,52 +98,54 @@ Handle<Value> GitOid::Mkstr(const Arguments& args) {
}
Handle<Value> GitOid::Mkraw(const Arguments& args) {
- GitOid* oid = ObjectWrap::Unwrap<GitOid>(args.This());
-
HandleScope scope;
+ GitOid* oid = ObjectWrap::Unwrap<GitOid>(args.This());
+
if(args.Length() == 0 || !args[0]->IsString()) {
return ThrowException(Exception::Error(String::New("Raw object id is required.")));
}
- String::Utf8Value raw(Local<Value>::New(args[0]));
+ String::Utf8Value raw(args[0]);
oid->Mkraw((const unsigned char*)*raw);
- return Local<Value>::New(args.This());
+ return scope.Close( args.This() );
}
Handle<Value> GitOid::Fmt(const Arguments& args) {
- GitOid *oid = ObjectWrap::Unwrap<GitOid>(args.This());
-
HandleScope scope;
- char buffer[32];
+ GitOid *oid = ObjectWrap::Unwrap<GitOid>(args.This());
+
+ char buffer[40];
oid->Fmt(buffer);
- return String::New(buffer);
+
+ return scope.Close( String::New(buffer) );
}
Handle<Value> GitOid::PathFmt(const Arguments& args) {
- GitOid *oid = ObjectWrap::Unwrap<GitOid>(args.This());
-
HandleScope scope;
+ GitOid *oid = ObjectWrap::Unwrap<GitOid>(args.This());
+
char buffer[41];
oid->PathFmt(buffer);
- return String::New(buffer);
+
+ return scope.Close( String::New(buffer) );
}
Handle<Value> GitOid::AllocFmt(const Arguments& args) {
- GitOid *oid = ObjectWrap::Unwrap<GitOid>(args.This());
-
HandleScope scope;
- return String::New(oid->AllocFmt());
+ GitOid *oid = ObjectWrap::Unwrap<GitOid>(args.This());
+
+ return scope.Close( String::New(oid->AllocFmt()) );
}
Handle<Value> GitOid::ToString(const Arguments& args) {
- GitOid *oid = ObjectWrap::Unwrap<GitOid>(args.This());
-
HandleScope scope;
+
+ GitOid *oid = ObjectWrap::Unwrap<GitOid>(args.This());
if(args.Length() == 0 || !args[0]->IsNumber()) {
return ThrowException(Exception::Error(String::New("Length argument is required and must be a Number.")));
@@ -151,7 +153,8 @@ Handle<Value> GitOid::ToString(const Arguments& args) {
char buffer[Int32::Cast(*args[0])->Value()+1];
oid->ToString(buffer, sizeof(buffer));
- return String::New(buffer);
+
+ return scope.Close( String::New(buffer) );
}
Handle<Value> GitOid::Cpy(const Arguments& args) {
@@ -169,7 +172,7 @@ Handle<Value> GitOid::Cpy(const Arguments& args) {
oid->Cpy(out);
clone->SetValue(*out);
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitOid::Cmp(const Arguments& args) {
@@ -191,6 +194,6 @@ Handle<Value> GitOid::Cmp(const Arguments& args) {
//int cmp = oid->Cmp(&a->GetValue(), &b->GetValue());
int cmp = 0;
- return Integer::New(cmp);
+ return scope.Close( Integer::New(cmp) );
}
Persistent<FunctionTemplate> GitOid::constructor_template;
View
11 src/reference.cc
@@ -58,11 +58,11 @@ Handle<Value> GitReference::New(const Arguments& args) {
}
Handle<Value> GitReference::Lookup(const Arguments& args) {
+ HandleScope scope;
+
GitReference *ref = ObjectWrap::Unwrap<GitReference>(args.This());
Local<Function> callback;
- HandleScope scope;
-
if(args.Length() == 0 || !args[0]->IsObject()) {
return ThrowException(Exception::Error(String::New("Repo is required and must be a Object.")));
}
@@ -91,7 +91,7 @@ Handle<Value> GitReference::Lookup(const Arguments& args) {
eio_custom(EIO_Lookup, EIO_PRI_DEFAULT, EIO_AfterLookup, ar);
ev_ref(EV_DEFAULT_UC);
- return Undefined();
+ return scope.Close( Undefined() );
}
int GitReference::EIO_Lookup(eio_req *req) {
@@ -129,9 +129,10 @@ int GitReference::EIO_AfterLookup(eio_req *req) {
}
Handle<Value> GitReference::Oid(const Arguments& args) {
- GitReference *ref = ObjectWrap::Unwrap<GitReference>(args.This());
HandleScope scope;
+ GitReference *ref = ObjectWrap::Unwrap<GitReference>(args.This());
+
if(args.Length() == 0 || !args[0]->IsObject()) {
return ThrowException(Exception::Error(String::New("Oid is required and must be an Object.")));
}
@@ -140,6 +141,6 @@ Handle<Value> GitReference::Oid(const Arguments& args) {
git_oid* in = const_cast<git_oid *>(ref->Oid());
oid->SetValue(*in);
- return Undefined();
+ return scope.Close( Undefined() );
}
Persistent<FunctionTemplate> GitReference::constructor_template;
View
26 src/repo.cc
@@ -66,15 +66,15 @@ Handle<Value> GitRepo::New(const Arguments& args) {
GitRepo *repo = new GitRepo();
repo->Wrap(args.This());
- return args.This();
+ return scope.Close( args.This() );
}
Handle<Value> GitRepo::Open(const Arguments& args) {
+ HandleScope scope;
+
GitRepo *repo = ObjectWrap::Unwrap<GitRepo>(args.This());
Local<Function> callback;
- HandleScope scope;
-
if(args.Length() == 0 || !args[0]->IsString()) {
return ThrowException(Exception::Error(String::New("Path is required and must be a String.")));
}
@@ -98,7 +98,7 @@ Handle<Value> GitRepo::Open(const Arguments& args) {
eio_custom(EIO_Open, EIO_PRI_DEFAULT, EIO_AfterOpen, ar);
ev_ref(EV_DEFAULT_UC);
- return Undefined();
+ return scope.Close( Undefined() );
}
int GitRepo::EIO_Open(eio_req *req) {
@@ -134,11 +134,11 @@ int GitRepo::EIO_AfterOpen(eio_req *req) {
}
Handle<Value> GitRepo::Lookup(const Arguments& args) {
+ HandleScope scope;
+
GitRepo *repo = ObjectWrap::Unwrap<GitRepo>(args.This());
Local<Function> callback;
- HandleScope scope;
-
if(args.Length() == 0 || !args[0]->IsObject()) {
return ThrowException(Exception::Error(String::New("Object is required and must be a Object.")));
}
@@ -166,7 +166,7 @@ Handle<Value> GitRepo::Lookup(const Arguments& args) {
//eio_custom(EIO_LookupRef, EIO_PRI_DEFAULT, EIO_AfterLookupRef, ar);
//ev_ref(EV_DEFAULT_UC);
- return Undefined();
+ return scope.Close( Undefined() );
}
int GitRepo::EIO_Lookup(eio_req *req) {
@@ -212,21 +212,21 @@ int GitRepo::EIO_AfterLookup(eio_req *req) {
}
Handle<Value> GitRepo::Free(const Arguments& args) {
- GitRepo *repo = ObjectWrap::Unwrap<GitRepo>(args.This());
-
HandleScope scope;
+ GitRepo *repo = ObjectWrap::Unwrap<GitRepo>(args.This());
+
repo->Free();
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitRepo::Init(const Arguments& args) {
+ HandleScope scope;
+
GitRepo *repo = ObjectWrap::Unwrap<GitRepo>(args.This());
Local<Function> callback;
- HandleScope scope;
-
if(args.Length() == 0 || !args[0]->IsString()) {
return ThrowException(Exception::Error(String::New("path is required and must be a String.")));
}
@@ -255,7 +255,7 @@ Handle<Value> GitRepo::Init(const Arguments& args) {
eio_custom(EIO_Init, EIO_PRI_DEFAULT, EIO_AfterInit, ar);
ev_ref(EV_DEFAULT_UC);
- return Undefined();
+ return scope.Close( Undefined() );
}
int GitRepo::EIO_Init(eio_req *req) {
View
20 src/revwalk.cc
@@ -95,7 +95,7 @@ Handle<Value> GitRevWalk::New(const Arguments& args) {
revwalk->Wrap(args.This());
- return args.This();
+ return scope.Close( args.This() );
}
Handle<Value> GitRevWalk::Reset(const Arguments& args) {
@@ -105,7 +105,7 @@ Handle<Value> GitRevWalk::Reset(const Arguments& args) {
revwalk->Reset();
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitRevWalk::Push(const Arguments& args) {
@@ -121,15 +121,15 @@ Handle<Value> GitRevWalk::Push(const Arguments& args) {
git_oid tmp = oid->GetValue();
int err = revwalk->Push(&tmp);
- return Integer::New(err);
+ return scope.Close( Integer::New(err) );
}
Handle<Value> GitRevWalk::Next(const Arguments& args) {
+ HandleScope scope;
+
GitRevWalk* revwalk = ObjectWrap::Unwrap<GitRevWalk>(args.This());
Local<Function> callback;
- HandleScope scope;
-
if(args.Length() == 0 || !args[0]->IsObject()) {
return ThrowException(Exception::Error(String::New("Oid is required and must be an Object.")));
}
@@ -150,7 +150,7 @@ Handle<Value> GitRevWalk::Next(const Arguments& args) {
eio_custom(EIO_Next, EIO_PRI_DEFAULT, EIO_AfterNext, ar);
ev_ref(EV_DEFAULT_UC);
- return Undefined();
+ return scope.Close( Undefined() );
}
int GitRevWalk::EIO_Next(eio_req *req) {
@@ -188,13 +188,13 @@ int GitRevWalk::EIO_AfterNext(eio_req *req) {
}
Handle<Value> GitRevWalk::Free(const Arguments& args) {
- GitRevWalk *revwalk = ObjectWrap::Unwrap<GitRevWalk>(args.This());
-
HandleScope scope;
+ GitRevWalk *revwalk = ObjectWrap::Unwrap<GitRevWalk>(args.This());
+
revwalk->Free();
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitRevWalk::Repository(const Arguments& args) {
@@ -209,6 +209,6 @@ Handle<Value> GitRevWalk::Repository(const Arguments& args) {
GitRepo *repo = ObjectWrap::Unwrap<GitRepo>(args[0]->ToObject());
repo->SetValue(revwalk->Repository());
- return Undefined();
+ return scope.Close( Undefined() );
}
Persistent<FunctionTemplate> GitRevWalk::constructor_template;
View
10 src/sig.cc
@@ -69,7 +69,7 @@ Handle<Value> GitSig::New(const Arguments& args) {
GitSig *sig = new GitSig();
sig->Wrap(args.This());
- return args.This();
+ return scope.Close( args.This() );
}
Handle<Value> GitSig::Dup(const Arguments& args) {
@@ -82,7 +82,7 @@ Handle<Value> GitSig::Dup(const Arguments& args) {
GitSig* sig = ObjectWrap::Unwrap<GitSig>(args[0]->ToObject());
sig->SetValue(sig->Dup());
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitSig::Free(const Arguments& args) {
@@ -91,7 +91,7 @@ Handle<Value> GitSig::Free(const Arguments& args) {
GitSig *sig = ObjectWrap::Unwrap<GitSig>(args.This());
sig->Free();
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitSig::Name(const Arguments& args) {
@@ -99,7 +99,7 @@ Handle<Value> GitSig::Name(const Arguments& args) {
GitSig *sig = ObjectWrap::Unwrap<GitSig>(args.This());
- return String::New(sig->Name());
+ return scope.Close( String::New(sig->Name()) );
}
Handle<Value> GitSig::Email(const Arguments& args) {
@@ -107,6 +107,6 @@ Handle<Value> GitSig::Email(const Arguments& args) {
GitSig *sig = ObjectWrap::Unwrap<GitSig>(args.This());
- return String::New(sig->Email());
+ return scope.Close( String::New(sig->Email()) );
}
Persistent<FunctionTemplate> GitSig::constructor_template;
View
16 src/tree.cc
@@ -64,7 +64,7 @@ Handle<Value> GitTree::New(const Arguments& args) {
tree->Wrap(args.This());
- return args.This();
+ return scope.Close( args.This() );
}
Handle<Value> GitTree::EntryCount(const Arguments& args) {
@@ -74,7 +74,7 @@ Handle<Value> GitTree::EntryCount(const Arguments& args) {
int count = tree->EntryCount();
- return Local<Value>::New(Integer::New(count));
+ return scope.Close( Integer::New(count) );
}
Handle<Value> GitTree::EntryByIndex(const Arguments& args) {
@@ -96,7 +96,7 @@ Handle<Value> GitTree::EntryByIndex(const Arguments& args) {
entry->SetValue(tree->EntryByIndex(index));
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitTree::EntryByName(const Arguments& args) {
@@ -120,7 +120,7 @@ Handle<Value> GitTree::EntryByName(const Arguments& args) {
entry->SetValue(tree->EntryByName(*name));
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitTree::SortEntries(const Arguments& args) {
@@ -130,16 +130,16 @@ Handle<Value> GitTree::SortEntries(const Arguments& args) {
int err = tree->SortEntries();
- return Integer::New(err);
+ return scope.Close( Integer::New(err) );
}
Handle<Value> GitTree::ClearEntries(const Arguments& args) {
- //HandleScope scope;
+ HandleScope scope;
//GitTree *tree = ObjectWrap::Unwrap<GitTree>(args.This());
//tree->ClearEntries();
- //
- return Undefined();
+
+ return scope.Close( Undefined() );
}
Persistent<FunctionTemplate> GitTree::constructor_template;
View
10 src/tree_entry.cc
@@ -59,7 +59,7 @@ Handle<Value> GitTreeEntry::New(const Arguments& args) {
entry->Wrap(args.This());
- return args.This();
+ return scope.Close( args.This() );
}
Handle<Value> GitTreeEntry::Name(const Arguments& args) {
@@ -67,7 +67,7 @@ Handle<Value> GitTreeEntry::Name(const Arguments& args) {
GitTreeEntry *entry = ObjectWrap::Unwrap<GitTreeEntry>(args.This());
- return String::New(entry->Name());
+ return scope.Close( String::New(entry->Name()) );
}
Handle<Value> GitTreeEntry::Attributes(const Arguments& args) {
@@ -75,7 +75,7 @@ Handle<Value> GitTreeEntry::Attributes(const Arguments& args) {
GitTreeEntry *entry = ObjectWrap::Unwrap<GitTreeEntry>(args.This());
- return Number::New(entry->Attributes());
+ return scope.Close( Number::New(entry->Attributes()) );
}
Handle<Value> GitTreeEntry::Id(const Arguments& args) {
@@ -91,7 +91,7 @@ Handle<Value> GitTreeEntry::Id(const Arguments& args) {
oid->SetValue(*const_cast<git_oid *>(entry->Id()));
- return Undefined();
+ return scope.Close( Undefined() );
}
Handle<Value> GitTreeEntry::ToObject(const Arguments& args) {
@@ -115,7 +115,7 @@ Handle<Value> GitTreeEntry::ToObject(const Arguments& args) {
//GitObject->SetValue(out);
//
- return scope.Close(Undefined());
+ return scope.Close( Undefined() );
}
Persistent<FunctionTemplate> GitTreeEntry::constructor_template;
Please sign in to comment.
Something went wrong with that request. Please try again.