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: 22-Apr-2010 16:34:29 Branch: HEAD Handle: 2010042214342900 Modified files: rpm/rpmio rpmsql.c Log: - rpmvt: more trash hauled. Summary: Revision Changes Path 2.54 +0 -84 rpm/rpmio/rpmsql.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/rpmsql.c ============================================================================ $ cvs diff -u -r2.53 -r2.54 rpmsql.c --- rpm/rpmio/rpmsql.c 22 Apr 2010 14:33:33 -0000 2.53 +++ rpm/rpmio/rpmsql.c 22 Apr 2010 14:34:29 -0000 2.54 @@ -666,90 +666,6 @@ return rc; } -#ifdef DYING -/*==============================================================*/ -int _npydb_debug; - -int _npydbColumn(rpmvc vc, void * _pContext, int colx) -{ - sqlite3_context * pContext = (sqlite3_context *) _pContext; - rpmvt vt = vc->vt; - rpmvd vd = vt->vd; - const char * path = vt->av[vc->ix]; - const char * col = vt->cols[colx]; - int idx = vd->idx; - - size_t nb = strlen(path); - miRE mire = mireNew(RPMMIRE_REGEX, 0); - int xx = mireSetCOptions(mire, RPMMIRE_REGEX, 0, 0, NULL); - int noffsets = 10 * 3; - int offsets[10 * 3]; - int i; - - int rc = SQLITE_OK; - -if (_npydb_debug < 0) -fprintf(stderr, "--> %s(%p,%p,%d)\n", __FUNCTION__, vc, pContext, colx); - - /* Split out {dir,hash,NVRA,N,V,R,A} pointers. */ - xx = mireRegcomp(mire, vd->regex); /* XXX move to rpmvtNew */ - - memset(offsets, -1, sizeof(offsets)); - xx = mireSetEOptions(mire, offsets, noffsets); - xx = mireRegexec(mire, path, nb); -assert(xx == 0); - - for (i = 0; i < noffsets; i += 2) { - if (offsets[i] < 0) - continue; -assert(offsets[i ] >= 0 && offsets[i ] <= (int)nb); -assert(offsets[i+1] >= 0 && offsets[i+1] <= (int)nb); - offsets[i+1] -= offsets[i]; /* XXX convert offset to length */ -if (_npydb_debug) -fprintf(stderr, "\t%d [%d,%d] %.*s\n", i/2, offsets[i], offsets[i+1], offsets[i+1], path+offsets[i]); - } - - if (!strcmp(col, "path")) - sqlite3_result_text(pContext, path, -1, SQLITE_STATIC); - else if (idx > 0 && !strcmp(col, "id")) - sqlite3_result_text(pContext, path+offsets[2*idx], offsets[2*idx+1], SQLITE_STATIC); - else { -assert(vt->fields); - for (i = 0; i < vt->nfields; i++) { - /* Slurp file contents for unknown field values. */ - if (!strcmp("*", vt->fields[i])) { - const char * fn = rpmGetPath(path, "/", col, NULL); - if (!Access(fn, R_OK)) { - rpmiob iob = NULL; - xx = rpmiobSlurp(fn, &iob); - sqlite3_result_text(pContext, rpmiobStr(iob), rpmiobLen(iob), SQLITE_TRANSIENT); - iob = rpmiobFree(iob); - } else - sqlite3_result_null(pContext); - break; - } else - if (!strcmp(col, vt->fields[i])) { - int ix = 2 * (i + 1); - const char * s = path + offsets[ix]; - size_t ns = offsets[ix+1]; - sqlite3_result_text(pContext, s, ns, SQLITE_STATIC); - break; - } - } - if (i == vt->nfields) - sqlite3_result_null(pContext); - } - - xx = mireSetEOptions(mire, NULL, 0); - mire = mireFree(mire); - -if (_npydb_debug < 0) -fprintf(stderr, "<-- %s(%p,%p,%d) rc %d\n", __FUNCTION__, vc, pContext, colx, rc); - - return rc; -} -#endif - /*==============================================================*/ int rpmvcColumn(rpmvc vc, void * _pContext, int colx) @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository [email protected]
