Install Tcl regex fixes to sync our regex engine with Tcl 8.4.8 (up from
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 24 Nov 2004 22:57:09 +0000 (22:57 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 24 Nov 2004 22:57:09 +0000 (22:57 +0000)
8.4.1).  This corrects some curious regex bugs, though not the greediness
issue I was hoping to find a solution for :-(

src/backend/regex/regcomp.c

index a6a17bd468efc54c142feaaddecea50132cf8bda..db7ec0d7246359ce0c4a26b128ece65ccfd4e8f1 100644 (file)
@@ -589,8 +589,13 @@ makesearch(struct vars * v,
                                break;
                if (b != NULL)
                {                                               /* must be split */
-                       s->tmp = slist;
-                       slist = s;
+                       if (s->tmp == NULL)
+                       {                                       /* if not already in the list */
+                                                               /* (fixes bugs 505048, 230589, */
+                                                               /* 840258, 504785) */
+                               s->tmp = slist;
+                               slist = s;
+                       }
                }
        }
 
@@ -2226,12 +2231,12 @@ stid(struct subre * t,
         size_t bufsize)
 {
        /* big enough for hex int or decimal t->retry? */
-       if (bufsize < sizeof(int) * 2 + 3 || bufsize < sizeof(t->retry) * 3 + 1)
+       if (bufsize < sizeof(void *) * 2 + 3 || bufsize < sizeof(t->retry) * 3 + 1)
                return "unable";
        if (t->retry != 0)
                sprintf(buf, "%d", t->retry);
        else
-               sprintf(buf, "0x%x", (int) t);  /* may lose bits, that's okay */
+               sprintf(buf, "%p", t);
        return buf;
 }
 #endif   /* REG_DEBUG */