lisdude / toaststunt

A network accessible, multi-user, programmable, interactive system for the creation of LambdaMOO style MOOs / MUDs.
63 stars 26 forks source link

Improve the PCRE cache #81

Closed tspivey closed 1 year ago

tspivey commented 1 year ago

This fixes the following problems with the cache:

  1. It would crash the server if it was used from multiple threads.
  2. The case matters option to pcre_match wasn't being taken into account, and the cache would match the wrong pattern. Example:
    ;pcre_match("test", "e", 0)
    => {["0" -> ["match" -> "e", "position" -> {2, 2}]]}
    ;pcre_match("TEST", "e", 1)
    => {["0" -> ["match" -> "E", "position" -> {2, 2}]]}

With this PR applied:

;pcre_match("test", "e", 0)
=> {["0" -> ["match" -> "e", "position" -> {2, 2}]]}
;pcre_match("TEST", "e", 1)
=> {}
ctoth commented 1 year ago

This closes #79