Tcl Source Code

View Ticket
Login
Ticket UUID: 187d7f499bfc71c054b7ebd745a37b8154b5ddb6
Title: Fix minor regexp bugs by adopting past Postgres patches
Type: Patch Version: 8.6.4
Submitter: tgl Created on: 2015-09-19 16:58:46
Subsystem: 43. Regexp Assigned To: dgp
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2015-09-21 19:26:25
Resolution: Accepted Closed By: dgp
    Closed on: 2015-09-21 19:26:25
Description:
The attached patch, if applied on top of the changes recommended in
open tickets
   *   [http://core.tcl.tk/tcl/tktview?name=d7ea9f9853]
   *   [http://core.tcl.tk/tcl/tktview?name=a3c3508599]
   *   [http://core.tcl.tk/tcl/tktview?name=0e0e150e49]

syncs Tcl 8.6.4's regexp library with Postgres HEAD as of today,
at least about as well as the two code bases are ever likely to
be in sync.  (There are a lot of differences in locale handling,
in particular, which I doubt we can remove because of differing
project requirements.)

These changes correspond to the following commits in the Postgres repo at
[http://git.postgresql.org/gitweb/?p=postgresql.git]
You can look at the commit log entries for them if you want more
detail.

   *   Speed up regex execution by creating/destroying subre DFAs only
once per exec(), not once per recursive dissection call:
<verbatim>
587359479acbbdc95c8e37da40707e37097423f5
ea8c7e9054abf23fa3de2f8e4414f60ac8a8b620
</verbatim>

   *   Simplify and document cNFA representation:
<verbatim>
c6aae3042be5249e672b731ebeb21875b5343010
</verbatim>

   *   Fix assorted memory leaks and missed error checks:
<verbatim>
d9c0c728afe734b7087dbb9a4bc16d5b682d139d
8a0258c31808c514755e3bba03cb052084c4887c
1567e659a877d35ab4b85dafff41b2845d50990f
54fd196ffc6432b62fe075e564f457db64fb288c
</verbatim>

   *   Const-ify variables where possible (you'd done some of this already):
<verbatim>
0d79c0a8cc20dbaa39112d78a9abb821c4ca3554
</verbatim>

   *   Suppress compiler warnings (in particular, build cleanly with -DREG_DEBUG):
<verbatim>
e621037eec4a1c9ec2d7056c9c1c11b9b03932cb
06ce02f989598506f611ef48ccb68e5e47d02859
</verbatim>

   *   Make dumpcolors() have tolerable performance:
<verbatim>
298c4575200e25d1e1c3447b5400e1a6f91bc500
</verbatim>

As in my previous patch submission, I've not tried very hard to meet
all Tcl layout conventions, in particular I've not added braces around
single-line if-blocks.  I'm hoping you have some automated way of
dealing with that.
User Comments: dgp added on 2015-09-21 19:26:25:
Accepted for Tcl 8.6.5.  No backport to 8.5.* . Let them eat upgrades.

tgl added on 2015-09-21 13:53:18:
Sure, I'd be willing to push this into a branch in your SCM.  As I recall, dkf had offered me commit privileges in connection with bug #1115587, but for some reason we never actually got it done.

FYI, there will be more patches coming if the ones I've already submitted get accepted.

oehhar added on 2015-09-21 08:58:44:

Thank you for the patch,

I would appreciate if you would get commit rights on tcl core, so you could add it as branch.

Core internal documentation is in this fossil wiki.

I just started a page with your provided info:

https://core.tcl.tk/tcl/wiki?name=regexp

That is better than nothing.

Another wizard will probably include your patch and close the ticket.

Thank you, Harald


tgl added on 2015-09-19 17:41:40:
BTW, I meant to add that we've been desultorily working on some internals documentation for the regexp library:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob_plain;f=src/backend/regex/README;hb=HEAD

I am not sure what the conventions are for internals docs in Tcl, and in any case you wouldn't want to adopt that text verbatim because a few of the things in it are Postgres-specific.  But feel free to borrow whatever you can use.

Attachments: