static JSBool rpmxar_ctor(JSContext *cx, uintN argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); JSObject *obj = JS_NewObjectForConstructor(cx, vp); JSBool ok = JS_FALSE; const char * _fn = "popt-1.14.xar"; const char * _fmode = "r"; _CTOR_DEBUG_ENTRY(_debug); if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ss", &_fn, &_fmode))) goto exit; if (JS_IsConstructing(cx, vp)) { (void) rpmxar_init(cx, obj, _fn, _fmode); } else { if ((obj = JS_NewObject(cx, &rpmxarClass, NULL, NULL)) == NULL) goto exit; *vp = OBJECT_TO_JSVAL(obj); } ok = JS_TRUE; exit: return ok; }
JSObject * rpmjs_NewXarObject(JSContext *cx, const char * _fn, const char *_fmode) { JSObject *obj; rpmxar xar; if ((obj = JS_NewObject(cx, &rpmxarClass, NULL, NULL)) == NULL) { /* XXX error msg */ return NULL; } if ((xar = rpmxar_init(cx, obj, _fn, _fmode)) == NULL) { /* XXX error msg */ return NULL; } return obj; }