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:
    Revision    Changes     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 -0000      1.2179
  +++ rpm/CHANGES       15 Feb 2008 19:04:37 -0000      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 -0000      2.224
  +++ rpm/lib/rpmrc.c   15 Feb 2008 19:04:37 -0000      2.225
  @@ -378,27 +378,6 @@
   }
   
   /**
  - * Destroy platform patterns.
  - * @param mire               platform pattern array
  - * @param nre                no 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 tag                identifier (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 -0000       2.38
  +++ rpm/rpmio/librpmio.vers   15 Feb 2008 19:04:37 -0000      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 -0000      1.20
  +++ rpm/rpmio/mire.c  15 Feb 2008 19:04:37 -0000      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 -0000      1.12
  +++ rpm/rpmio/mire.h  15 Feb 2008 19:04:37 -0000      1.13
  @@ -128,6 +128,16 @@
        /[EMAIL PROTECTED] mire @*/;
   
   /**
  + * Destroy compiled patterns.
  + * @param mire               pattern array
  + * @param nre                no of patterns in array
  + * @return           NULL always
  + */
  +/[EMAIL PROTECTED]@*/
  +void * mireFreeAll(/[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ miRE mire, 
int nmire)
  +     /[EMAIL PROTECTED] mire @*/;
  +
  +/**
    * Create pattern container.
    * @param mode               type of pattern match
    * @param tag                identifier (e.g. an rpmTag)
  @@ -157,6 +167,18 @@
   int mireRegcomp(miRE mire, const char * pattern)
        /[EMAIL PROTECTED] mire @*/;
   
  +/**
  + * Apply array of patterns to a string.
  + * @param mire               compiled pattern array
  + * @param nmire              no. of patterns in array
  + * @param s          string to apply against
  + * @param slen               length of string (0 will use strlen(s))
  + * @param rc         -1 == excluding, +1 == including, 0 == single pattern
  + * @return           termination condition
  + */
  +int mireApply(miRE mire, int nmire, const char *s, size_t slen, int rc)
  +     /[EMAIL PROTECTED] [EMAIL PROTECTED]/;
  +
   #ifdef __cplusplus
   }
   #endif
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmgrep.c
  ============================================================================
  $ cvs diff -u -r1.43 -r1.44 rpmgrep.c
  --- rpm/rpmio/rpmgrep.c       15 Feb 2008 18:36:21 -0000      1.43
  +++ rpm/rpmio/rpmgrep.c       15 Feb 2008 19:04:37 -0000      1.44
  @@ -835,36 +835,6 @@
   }
   
   /**
  - * Apply array of patterns to a string.
  - * @param mire               compiled pattern array
  - * @param nmire              no. of patterns in array
  - * @param s          string to apply against
  - * @param len                length of string (0 will use strlen(s)
  - * @param rc         -1 == excluding, +1 == including, 0 == single pattern
  - * @return           termination condition
  - */
  -static int mireApply(miRE mire, int nmire, const char *s, int len, int rc)
  -{
  -    int i;
  -
  -    if (mire)
  -    for (i = 0; i < nmire; mire++, i++) {
  -     int xx = mireRegexec(mire, s, len);
  -
  -     /* 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;
  -   
  -}
  -
  -/**
    * Check file name for a suffix.
    * @param fn         file name
    * @param suffix     suffix
  @@ -1013,27 +983,6 @@
   }
   
   /**
  - * Destroy compiled patterns.
  - * @param mire               pattern array
  - * @param nre                no 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 tag                identifier (like an rpmTag)
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to