Skip to content

Commit

Permalink
More update awesome.
Browse files Browse the repository at this point in the history
  • Loading branch information
davisp committed Aug 3, 2009
1 parent ad1f4b4 commit d111e02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
22 changes: 7 additions & 15 deletions spidermonkey/javascript/object.cpp
Expand Up @@ -304,27 +304,19 @@ get_py_obj(JSContext* cx, JSObject* obj)
PyObject*
mk_args_tpl(Context* pycx, JSContext* jscx, uintN argc, jsval* argv)
{
PyObject* tpl = NULL;
PyObject* tmp = NULL;

tpl = PyTuple_New(argc);
if(tpl == NULL)
PyObjectXDR tpl = PyTuple_New(argc);
if(!tpl)
{
JS_ReportError(jscx, "Failed to build args value.");
goto error;
return NULL;
}

for(unsigned int idx = 0; idx < argc; idx++)
{
tmp = js2py(pycx, argv[idx]);
if(tmp == NULL) goto error;
PyTuple_SET_ITEM(tpl, idx, tmp);
PyObject* tmp = js2py(pycx, argv[idx]);
if(!tmp) return NULL;
PyTuple_SET_ITEM(tpl.get(), idx, tmp);
}

goto success;

error:
Py_XDECREF(tpl);
success:
return tpl;
return tpl.release();
}
4 changes: 3 additions & 1 deletion spidermonkey/utils/utils.h
Expand Up @@ -52,9 +52,11 @@ template <class T> class PyXDR {
this->data = p;
}

void release()
T* release()
{
T* p = this->data;
this->data = NULL;
return p;
}

protected:
Expand Down

0 comments on commit d111e02

Please sign in to comment.