OSSP CVS Repository

ossp - Check-in [2476]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2476
Date: 2002-Aug-02 13:00:23 (local)
2002-Aug-02 11:00:23 (UTC)
User:rse
Branch:
Comment: Remove pcre_study(3) usage, because we do no repeated matchings and additionally (according to pcre(3)) studying for non-anchored patterns that do not have a single fixed starting character is useless.
Tickets:
Inspections:
Files:
ossp-pkg/fsl/ChangeLog      1.3 -> 1.4     6 inserted, 0 deleted
ossp-pkg/fsl/fsl.c      1.47 -> 1.48     1 inserted, 13 deleted

ossp-pkg/fsl/ChangeLog 1.3 -> 1.4

--- ChangeLog    2002/08/02 10:56:21     1.3
+++ ChangeLog    2002/08/02 11:00:23     1.4
@@ -11,6 +11,12 @@
 
   Changes between 1.0.0 and 1.0.1 (01-Aug-2002 to xx-Aug-2002)
 
+    *) Remove pcre_study(3) usage, because we do no repeated matchings
+       and additionally (according to pcre(3)) studying for non-anchored
+       patterns that do not have a single fixed starting character is
+       useless.
+       [Ralf S. Engelschall <rse@engelschall.com>]
+
     *) Compile regular expressions with PCRE_ANCHORED to make sure
        they are anchored. This means the ident "bar/.*" does not match
        "foobar/quux". If it should it now has to be written ".*bar/quux".


ossp-pkg/fsl/fsl.c 1.47 -> 1.48

--- fsl.c        2002/08/02 10:56:22     1.47
+++ fsl.c        2002/08/02 11:00:23     1.48
@@ -430,7 +430,6 @@
     l2_result_t       l2rv;
     int               matchcount = 0;
     pcre       *pcreRegex = NULL;
-    pcre_extra *pcreExtra = NULL;
     const char *cpError;
     int         iError;
     int         nMatch;
@@ -528,11 +527,8 @@
                 /* compile regular expression into finite state machine and optimize */
                 if ((pcreRegex = pcre_compile(argmatch, PCRE_ANCHORED|PCRE_CASELESS, &cpError, &iError, NULL)) == NULL) {
                     fsldebug(L2_LEVEL_ERROR, "processcfg: pcre_compile() failed with error %s (%d)", cpError, iError); CU(FSL_ERR_CUS); }
-                pcreExtra = pcre_study(pcreRegex, 0, &cpError);
-                if (cpError != NULL) {
-                    fsldebug(L2_LEVEL_ERROR, "processcfg: pcre_study() failed with error %s", cpError); CU(FSL_ERR_CUS); }
 
-                nMatch = pcre_exec(pcreRegex, pcreExtra, cpISF, strlen(cpISF), 0, 0, ovec, OVECSIZE);
+                nMatch = pcre_exec(pcreRegex, NULL, cpISF, strlen(cpISF), 0, 0, ovec, OVECSIZE);
                 if (nMatch < 0)
                     fsldebug(L2_LEVEL_TRACE, "processcfg: matching ident/facility \"%s\" against section \"%s\" failed.", cpISF, argmatch);
                 else
@@ -561,10 +557,6 @@
                     matchcount++;
                     free(argl2spec);
                 }
-                if (pcreExtra != NULL) {
-                    pcre_free(pcreExtra);
-                    pcreExtra = NULL;
-                }
                 if (pcreRegex != NULL) {
                     pcre_free(pcreRegex);
                     pcreRegex = NULL;
@@ -612,10 +604,6 @@
     else
         CU(FSL_OK);
 CUS:
-    if (pcreExtra != NULL) {
-        pcre_free(pcreExtra);
-        pcreExtra = NULL;
-    }
     if (pcreRegex != NULL) {
         pcre_free(pcreRegex);
         pcreRegex = NULL;

CVSTrac 2.0.1