[CVS] RPM: rpm/ CHANGES rpm/lib/ rpmrc.c rpm/rpmio/ librpmio.vers mire...
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-Feb-2008 20:04:38 Branch: HEAD Handle: 2008021519043700 Modified files: rpm CHANGES rpm/lib rpmrc.c rpm/rpmio librpmio.vers mire.c mire.h rpmgrep.c Log: - mire: add mireApply() and mireFreeAll() routines. Summary: RevisionChanges Path 1.2180 +1 -0 rpm/CHANGES 2.225 +0 -21 rpm/lib/rpmrc.c 2.39+2 -0 rpm/rpmio/librpmio.vers 1.21+36 -0 rpm/rpmio/mire.c 1.13+22 -0 rpm/rpmio/mire.h 1.44+0 -51 rpm/rpmio/rpmgrep.c patch -p0 '@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.2179 -r1.2180 CHANGES --- rpm/CHANGES 15 Feb 2008 17:01:24 - 1.2179 +++ rpm/CHANGES 15 Feb 2008 19:04:37 - 1.2180 @@ -1,4 +1,5 @@ 5.0.0 - 5.1a1: +- jbj: mire: add mireApply() and mireFreeAll() routines. - jbj: rpmgrep: attempt LZMA decompress with .lzma suffix. - jbj: rpmgrep: apply multiple --include/--exclude patterns to paths. - jbj: rpmgrep: permit multiple --file, --exclude, and --include options. @@ . patch -p0 '@@ .' Index: rpm/lib/rpmrc.c $ cvs diff -u -r2.224 -r2.225 rpmrc.c --- rpm/lib/rpmrc.c 10 Feb 2008 18:32:32 - 2.224 +++ rpm/lib/rpmrc.c 15 Feb 2008 19:04:37 - 2.225 @@ -378,27 +378,6 @@ } /** - * Destroy platform patterns. - * @param mire platform pattern array - * @param nreno of patterns in array - * @return NULL always - */ -/[EMAIL PROTECTED]@*//* XXX miRE array, not refcounted. */ -/[EMAIL PROTECTED]@*/ -static void * mireFreeAll(/[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ miRE mire, int nre) - /[EMAIL PROTECTED] [EMAIL PROTECTED]/ -{ -if (mire != NULL) { - int i; - for (i = 0; i nre; i++) - (void) mireClean(mire + i); - mire = _free(mire); -} -return NULL; -} -/[EMAIL PROTECTED]@*/ - -/** * Append pattern to array. * @param mode type of pattern match * @param tagidentifier (like an rpmTag) @@ . patch -p0 '@@ .' Index: rpm/rpmio/librpmio.vers $ cvs diff -u -r2.38 -r2.39 librpmio.vers --- rpm/rpmio/librpmio.vers 9 Feb 2008 23:12:33 - 2.38 +++ rpm/rpmio/librpmio.vers 15 Feb 2008 19:04:37 - 2.39 @@ -135,8 +135,10 @@ lzdio; max_macro_depth; _mire_debug; +mireApply; mireClean; mireFree; +mireFreeAll; mireNew; mireRegexec; mireRegcomp; @@ . patch -p0 '@@ .' Index: rpm/rpmio/mire.c $ cvs diff -u -r1.20 -r1.21 mire.c --- rpm/rpmio/mire.c 11 Feb 2008 23:06:20 - 1.20 +++ rpm/rpmio/mire.c 15 Feb 2008 19:04:37 - 1.21 @@ -100,6 +100,19 @@ return NULL; } +/[EMAIL PROTECTED]@*//* XXX miRE array, not refcounted. */ +void * mireFreeAll(miRE mire, int nmire) +{ +if (mire != NULL) { + int i; + for (i = 0; i nmire; i++) + (void) mireClean(mire + i); + mire = _free(mire); +} +return NULL; +} +/[EMAIL PROTECTED]@*/ + miRE mireNew(rpmMireMode mode, int tag) { miRE mire = xcalloc(1, sizeof(*mire)); @@ -226,3 +239,26 @@ /[EMAIL PROTECTED]@*/ return rc; } + +int mireApply(miRE mire, int nmire, const char *s, size_t slen, int rc) +{ +int i; + +if (slen == 0) + slen = strlen(s); + +if (mire) +for (i = 0; i nmire; mire++, i++) { + int xx = mireRegexec(mire, s, slen); + + /* Check if excluding or including condition applies. */ + if (rc 0 xx 0) + continue; /* excluding: continue on negative matches. */ + if (rc 0 xx = 0) + continue; /* including: continue on positive matches. */ + /* Save 1st found termination condition and exit. */ + rc = xx; + break; +} +return rc; +} @@ . patch -p0 '@@ .' Index: rpm/rpmio/mire.h $ cvs diff -u -r1.12 -r1.13 mire.h --- rpm/rpmio/mire.h 11 Feb 2008 00:30:29 -
[CVS] RPM: rpm/ CHANGES rpm/lib/ rpmrc.c rpm/rpmio/ librpmio.vers mire...
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-Feb-2008 20:37:12 Branch: HEAD Handle: 2008021519371200 Modified files: rpm CHANGES rpm/lib rpmrc.c rpm/rpmio librpmio.vers mire.c mire.h rpmgrep.c Log: - jbj: mire: add mireAppend() routine. Summary: RevisionChanges Path 1.2181 +1 -0 rpm/CHANGES 2.226 +2 -32 rpm/lib/rpmrc.c 2.40+1 -0 rpm/rpmio/librpmio.vers 1.22+18 -0 rpm/rpmio/mire.c 1.14+15 -0 rpm/rpmio/mire.h 1.45+6 -32 rpm/rpmio/rpmgrep.c patch -p0 '@@ .' Index: rpm/CHANGES $ cvs diff -u -r1.2180 -r1.2181 CHANGES --- rpm/CHANGES 15 Feb 2008 19:04:37 - 1.2180 +++ rpm/CHANGES 15 Feb 2008 19:37:12 - 1.2181 @@ -1,4 +1,5 @@ 5.0.0 - 5.1a1: +- jbj: mire: add mireAppend() routine. - jbj: mire: add mireApply() and mireFreeAll() routines. - jbj: rpmgrep: attempt LZMA decompress with .lzma suffix. - jbj: rpmgrep: apply multiple --include/--exclude patterns to paths. @@ . patch -p0 '@@ .' Index: rpm/lib/rpmrc.c $ cvs diff -u -r2.225 -r2.226 rpmrc.c --- rpm/lib/rpmrc.c 15 Feb 2008 19:04:37 - 2.225 +++ rpm/lib/rpmrc.c 15 Feb 2008 19:37:12 - 2.226 @@ -378,36 +378,6 @@ } /** - * Append pattern to array. - * @param mode type of pattern match - * @param tagidentifier (like an rpmTag) - * @param patternpattern to compile - * @retval *mi_rep platform pattern array - * @retval *mi_nrep no. of patterns in array - */ -/[EMAIL PROTECTED]@*//* XXX miRE array, not refcounted. */ -/[EMAIL PROTECTED]@*/ -static int mireAppend(rpmMireMode mode, int tag, const char * pattern, - miRE * mi_rep, int * mi_nrep) - /[EMAIL PROTECTED] *mi_rep, *mi_nrep @*/ -{ -miRE mire; - -mire = (*mi_rep); -/[EMAIL PROTECTED]@*/ -mire = xrealloc(mire, ((*mi_nrep) + 1) * sizeof(*mire)); -/[EMAIL PROTECTED]@*/ -(*mi_rep) = mire; -mire += (*mi_nrep); -(*mi_nrep)++; -memset(mire, 0, sizeof(*mire)); -mire-mode = mode; -mire-tag = tag; -return mireRegcomp(mire, pattern); -} -/[EMAIL PROTECTED]@*/ - -/** * Read and configure /etc/rpm/platform patterns. * @param platform path to platform patterns * @return RPMRC_OK on success @@ -452,7 +422,7 @@ while (--t p xisspace(*t)) *t = '\0'; if (t p) - xx = mireAppend(RPMMIRE_REGEX, 0, p, mi_re, mi_nre); + xx = mireAppend(RPMMIRE_REGEX, 0, p, NULL, mi_re, mi_nre); continue; } @@ -470,7 +440,7 @@ (cvog *cvog-gnu ? - : NULL), (cvog ? cvog-gnu : NULL), NULL); #endif - xx = mireAppend(RPMMIRE_STRCMP, 0, p, mi_re, mi_nre); + xx = mireAppend(RPMMIRE_STRCMP, 0, p, NULL, mi_re, mi_nre); p = _free(p); init_platform++; @@ . patch -p0 '@@ .' Index: rpm/rpmio/librpmio.vers $ cvs diff -u -r2.39 -r2.40 librpmio.vers --- rpm/rpmio/librpmio.vers 15 Feb 2008 19:04:37 - 2.39 +++ rpm/rpmio/librpmio.vers 15 Feb 2008 19:37:12 - 2.40 @@ -135,6 +135,7 @@ lzdio; max_macro_depth; _mire_debug; +mireAppend; mireApply; mireClean; mireFree; @@ . patch -p0 '@@ .' Index: rpm/rpmio/mire.c $ cvs diff -u -r1.21 -r1.22 mire.c --- rpm/rpmio/mire.c 15 Feb 2008 19:04:37 - 1.21 +++ rpm/rpmio/mire.c 15 Feb 2008 19:37:12 - 1.22 @@ -240,6 +240,24 @@ return rc; } +/[EMAIL PROTECTED]@*//* XXX miRE array, not refcounted. */ +int mireAppend(rpmMireMode mode, int tag, const char * pattern, + const unsigned char * table, miRE * mirep, int * nmirep) +{ +/[EMAIL PROTECTED]@*/ +miRE mire = xrealloc((*mirep), ((*nmirep) + 1) * sizeof(*mire)); +/[EMAIL PROTECTED]@*/ + +(*mirep) = mire; +mire += (*nmirep)++; +memset(mire, 0, sizeof(*mire)); +mire-mode = mode; +mire-tag = tag; +mire-table = table; +return mireRegcomp(mire,