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: 15-Apr-2010 15:11:06 Branch: HEAD Handle: 2010041513110501 Modified files: rpm CHANGES rpm/rpmio rpmsql.c rpmsql.h Log: - rpmsql: rewire rpmvt/rpmvc objects so sqlite/mutexes interoperate. Summary: Revision Changes Path 1.3328 +1 -0 rpm/CHANGES 2.39 +21 -25 rpm/rpmio/rpmsql.c 2.18 +26 -11 rpm/rpmio/rpmsql.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3327 -r1.3328 CHANGES --- rpm/CHANGES 14 Apr 2010 23:34:30 -0000 1.3327 +++ rpm/CHANGES 15 Apr 2010 13:11:05 -0000 1.3328 @@ -1,5 +1,6 @@ 5.2b1 -> 5.3a1 + - jbj: rpmsql: rewire rpmvt/rpmvc objects so sqlite/mutexes interoperate. - jbj: rpmsql: stub-in virtual table/cursor framework. - jbj: tests: update check-sql tests. - jbj: build: permit %post -p "<sql> OPTS ARGS" syntax. @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmsql.c ============================================================================ $ cvs diff -u -r2.38 -r2.39 rpmsql.c --- rpm/rpmio/rpmsql.c 14 Apr 2010 23:34:31 -0000 2.38 +++ rpm/rpmio/rpmsql.c 15 Apr 2010 13:11:06 -0000 2.39 @@ -58,11 +58,13 @@ /** * rpmvt pool destructor. */ -static void rpmvtFini(void * _vt) +static void rpmvtFini(void * _VT) /*...@globals fileSystem @*/ - /*...@modifies *_vt, fileSystem @*/ + /*...@modifies *_VT, fileSystem @*/ { - rpmvt vt = _vt; + struct rpmVT_s * VT = _VT; + rpmvt vt = &VT->vt; + SQLDBG((stderr, "==> %s(%p)\n", __FUNCTION__, vt)); vt->av = argvFree(vt->av); @@ -76,23 +78,22 @@ /*...@globals _rpmvtPool, fileSystem @*/ /*...@modifies pool, _rpmvtPool, fileSystem @*/ { - rpmvt vt; + struct rpmVT_s * VT; if (_rpmvtPool == NULL) { - _rpmvtPool = rpmioNewPool("vt", sizeof(*vt), -1, _rpmvt_debug, + _rpmvtPool = rpmioNewPool("vt", sizeof(*VT), -1, _rpmvt_debug, NULL, NULL, rpmvtFini); pool = _rpmvtPool; } - vt = (rpmvt) rpmioGetPool(pool, sizeof(*vt)); - memset(((char *)vt)+sizeof(vt->_item), 0, sizeof(*vt)-sizeof(vt->_item)); - return vt; + VT = (struct rpmVT_s *) rpmioGetPool(pool, sizeof(*VT)); + memset(((char *)VT)+sizeof(VT->_item), 0, sizeof(*VT)-sizeof(VT->_item)); + return &VT->vt; } rpmvt rpmvtNew(void * pModule, rpmvData vd, const char * colSql) { - rpmvt vt = rpmvtGetPool(NULL); + rpmvt vt = rpmvtGetPool(_rpmvtPool); - vt->pModule = pModule; vt->av = NULL; vt->ac = 0; vt->vd = vd; @@ -229,9 +230,7 @@ { int rc = SQLITE_OK; SQLDBG((stderr, "--> %s(%p)\n", __FUNCTION__, vt)); -#ifdef NOTYET /* XXX hmm yarn lock getting clobbered? */ vt = rpmvtFree(vt); -#endif SQLDBG((stderr, "<-- %s(%p) rc %d\n", __FUNCTION__, vt, rc)); return rc; } @@ -240,9 +239,7 @@ { int rc = SQLITE_OK; SQLDBG((stderr, "--> %s(%p)\n", __FUNCTION__, vt)); -#ifdef NOTYET /* XXX hmm yarn lock getting clobbered? */ vt = rpmvtFree(vt); -#endif SQLDBG((stderr, "<-- %s(%p) rc %d\n", __FUNCTION__, vt, rc)); return rc; } @@ -303,11 +300,12 @@ /** * rpmvc pool destructor. */ -static void rpmvcFini(void * _vc) +static void rpmvcFini(void * _VC) /*...@globals fileSystem @*/ - /*...@modifies *_vc, fileSystem @*/ + /*...@modifies *_VC, fileSystem @*/ { - rpmvc vc = _vc; + struct rpmVC_s * VC = _VC; + rpmvc vc = &VC->vc; SQLDBG((stderr, "==> %s(%p)\n", __FUNCTION__, vc)); @@ -320,21 +318,21 @@ /*...@globals _rpmvcPool, fileSystem @*/ /*...@modifies pool, _rpmvcPool, fileSystem @*/ { - rpmvc vc; + struct rpmVC_s * VC; if (_rpmvcPool == NULL) { - _rpmvcPool = rpmioNewPool("vc", sizeof(*vc), -1, _rpmvc_debug, + _rpmvcPool = rpmioNewPool("vc", sizeof(*VC), -1, _rpmvc_debug, NULL, NULL, rpmvcFini); pool = _rpmvcPool; } - vc = (rpmvc) rpmioGetPool(pool, sizeof(*vc)); - memset(((char *)vc)+sizeof(vc->_item), 0, sizeof(*vc)-sizeof(vc->_item)); - return vc; + VC = (struct rpmVC_s *) rpmioGetPool(pool, sizeof(*VC)); + memset(((char *)VC)+sizeof(VC->_item), 0, sizeof(*VC)-sizeof(VC->_item)); + return &VC->vc; } rpmvc rpmvcNew(rpmvt vt, int nrows) { - rpmvc vc = rpmvcGetPool(NULL); + rpmvc vc = rpmvcGetPool(_rpmvcPool); vc->vt = vt; vc->ix = -1; @@ -365,9 +363,7 @@ int rc = SQLITE_OK; SQLDBG((stderr, "--> %s(%p)\n", __FUNCTION__, vc)); -#ifdef NOTYET /* XXX hmm yarn lock getting clobbered? */ vc = rpmvcFree(vc); -#endif SQLDBG((stderr, "<-- %s(%p) rc %d\n", __FUNCTION__, vc, rc)); return rc; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmsql.h ============================================================================ $ cvs diff -u -r2.17 -r2.18 rpmsql.h --- rpm/rpmio/rpmsql.h 14 Apr 2010 23:34:31 -0000 2.17 +++ rpm/rpmio/rpmsql.h 15 Apr 2010 13:11:06 -0000 2.18 @@ -130,34 +130,49 @@ #endif /* _RPMSQL_INTERNAL */ #ifdef _RPMVT_INTERNAL +struct rpmvt_vtab_s { + const void * pModule; + int nRef; + char * zErrMsg; +}; struct rpmvt_s { - struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ - void * pModule; /* Linkage to module (sqlite3_module *) */ + struct rpmvt_vtab_s _base; /* for sqlite */ int ix; /* Current column index. */ int ncols; /* No. of column items. */ rpmvData vd; /* Data object. */ int ac; const char ** av; +}; +struct rpmVT_s { + struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ + struct rpmvt_s vt; #if defined(__LCLINT__) /*...@refs@*/ int nrefs; /*!< (unused) keep splint happy */ #endif }; -#endif +#endif /* _RPMVT_INTERNAL */ #ifdef _RPMVC_INTERNAL +struct rpmvc_cursor_s { + const void * pVTab; +}; struct rpmvc_s { - struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ + struct rpmvc_cursor_s _base;/* for sqlite */ rpmvt vt; /* Linkage to virtual table. */ int ix; /* Current row index. */ int nrows; /* No. of row items. */ rpmvData vd; /* Data object. */ +}; +struct rpmVC_s { + struct rpmioItem_s _item; /*!< usage mutex and pool identifier. */ + struct rpmvc_s vc; #if defined(__LCLINT__) /*...@refs@*/ int nrefs; /*!< (unused) keep splint happy */ #endif }; -#endif +#endif /* _RPMVC_INTERNAL */ #ifdef __cplusplus extern "C" { @@ -261,7 +276,7 @@ rpmvt rpmvtUnlink (/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmvt vt) /*...@modifies vt @*/; #define rpmvtUnlink(_vt) \ - ((rpmvt)rpmioUnlinkPoolItem((rpmioItem)(_vt), __FUNCTION__, __FILE__, __LINE__)) + ((rpmvt)(rpmioUnlinkPoolItem(((rpmioItem)(_vt))-1, __FUNCTION__, __FILE__, __LINE__)+1)) /** * Reference a virtual table instance. @@ -272,7 +287,7 @@ rpmvt rpmvtLink (/*...@null@*/ rpmvt vt) /*...@modifies vt @*/; #define rpmvtLink(_vt) \ - ((rpmvt)rpmioLinkPoolItem((rpmioItem)(_vt), __FUNCTION__, __FILE__, __LINE__)) + ((rpmvt)(rpmioLinkPoolItem(((rpmioItem)(_vt))-1, __FUNCTION__, __FILE__, __LINE__)+1)) /** * Derference a virtual table instance. @@ -284,7 +299,7 @@ /*...@globals fileSystem @*/ /*...@modifies vt, fileSystem @*/; #define rpmvtFree(_vt) \ - ((rpmvt)rpmioFreePoolItem((rpmioItem)(_vt), __FUNCTION__, __FILE__, __LINE__)) + ((rpmvt)rpmioFreePoolItem(((rpmioItem)(_vt))-1, __FUNCTION__, __FILE__, __LINE__)) rpmvt rpmvtNew(void * pModule, rpmvData vd, const char * colSql) /*...@*/; @@ -423,7 +438,7 @@ rpmvc rpmvcUnlink (/*...@killref@*/ /*...@only@*/ /*...@null@*/ rpmvc vc) /*...@modifies vc @*/; #define rpmvcUnlink(_vc) \ - ((rpmvc)rpmioUnlinkPoolItem((rpmioItem)(_vc), __FUNCTION__, __FILE__, __LINE__)) + ((rpmvc)(rpmioUnlinkPoolItem(((rpmioItem)(_vc))-1, __FUNCTION__, __FILE__, __LINE__)+1)) /** * Reference a virtual cursor instance. @@ -434,7 +449,7 @@ rpmvc rpmvcLink (/*...@null@*/ rpmvc vc) /*...@modifies vc @*/; #define rpmvcLink(_vc) \ - ((rpmvc)rpmioLinkPoolItem((rpmioItem)(_vc), __FUNCTION__, __FILE__, __LINE__)) + ((rpmvc)(rpmioLinkPoolItem(((rpmioItem)(_vc))-1, __FUNCTION__, __FILE__, __LINE__)+1)) /** * Derference a virtual cursor instance. @@ -446,7 +461,7 @@ /*...@globals fileSystem @*/ /*...@modifies vc, fileSystem @*/; #define rpmvcFree(_vc) \ - ((rpmvc)rpmioFreePoolItem((rpmioItem)(_vc), __FUNCTION__, __FILE__, __LINE__)) + ((rpmvc)rpmioFreePoolItem(((rpmioItem)(_vc))-1, __FUNCTION__, __FILE__, __LINE__)) rpmvc rpmvcNew(rpmvt vt, int nrows) /*...@*/; @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
