RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: [email protected] Module: rpm Date: 01-Jan-2010 22:42:08 Branch: HEAD Handle: 2010010121420800 Modified files: rpm/js rpmte-js.c Log: - JS: rpmte: add a newref for retrieved ds/fi subobjects. Summary: Revision Changes Path 1.14 +20 -6 rpm/js/rpmte-js.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/js/rpmte-js.c ============================================================================ $ cvs diff -u -r1.13 -r1.14 rpmte-js.c --- rpm/js/rpmte-js.c 28 Dec 2009 20:39:10 -0000 1.13 +++ rpm/js/rpmte-js.c 1 Jan 2010 21:42:08 -0000 1.14 @@ -16,6 +16,8 @@ #include <rpmdb.h> +#include <rpmds.h> +#include <rpmfi.h> #include <rpmal.h> #include <rpmts.h> #define _RPMTE_INTERNAL /* XXX for rpmteNew/rpmteFree */ @@ -48,10 +50,16 @@ goto exit; { rpmds ds = NULL; JSObject *dso = NULL; - if ((ds = rpmteDS(te, tagN)) != NULL - && (dso = JS_NewObject(cx, &rpmdsClass, NULL, NULL)) != NULL - && JS_SetPrivate(cx, dso, ds)) + if ((ds = rpmteDS(te, tagN)) == NULL) + *rval = JSVAL_NULL; + else + if ((dso = JS_NewObject(cx, &rpmdsClass, NULL, NULL)) != NULL + && JS_SetPrivate(cx, dso, rpmdsLink(ds, __FUNCTION__))) *rval = OBJECT_TO_JSVAL(dso); + else { + ds = rpmdsFree(ds); + *rval = JSVAL_VOID; + } } ok = JS_TRUE; exit: @@ -72,10 +80,16 @@ goto exit; { rpmfi fi = NULL; JSObject *fio = NULL; - if ((fi = rpmteFI(te, tagN)) != NULL - && (fio = JS_NewObject(cx, &rpmfiClass, NULL, NULL)) != NULL - && JS_SetPrivate(cx, fio, fi)) + if ((fi = rpmteFI(te, tagN)) == NULL) + *rval = JSVAL_NULL; + else + if ((fio = JS_NewObject(cx, &rpmfiClass, NULL, NULL)) != NULL + && JS_SetPrivate(cx, fio, rpmfiLink(fi, __FUNCTION__))) *rval = OBJECT_TO_JSVAL(fio); + else { + fi = rpmfiFree(fi); + *rval = JSVAL_VOID; + } } ok = JS_TRUE; exit: @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
