diff options
author | Araq <rumpf_a@web.de> | 2019-03-19 15:49:24 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-03-19 15:49:24 +0100 |
commit | eeae88d81e85bedc34f578d3c8e7be3bb9f18f37 (patch) | |
tree | 32aab34a3bdc2471c6252d31f4ed625d9a49e6da /lib/impure/re.nim | |
parent | bfc7522401dec97834d2f0d79f34821d86bc448e (diff) | |
download | Nim-eeae88d81e85bedc34f578d3c8e7be3bb9f18f37.tar.gz |
live with the hacks, PCRE's design is crap
Diffstat (limited to 'lib/impure/re.nim')
-rw-r--r-- | lib/impure/re.nim | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/impure/re.nim b/lib/impure/re.nim index 6f57185e6..4f32cd5fb 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -60,9 +60,12 @@ proc rawCompile(pattern: string, flags: cint): ptr Pcre = raiseInvalidRegex($msg & "\n" & pattern & "\n" & spaces(offset) & "^\n") proc finalizeRegEx(x: Regex) = - pcre.free(x.h) + # XXX This is a hack, but PCRE does not export its "free" function properly. + # Sigh. The hack relies on PCRE's implementation (see ``pcre_get.c``). + # Fortunately the implementation is unlikely to change. + pcre.free_substring(cast[cstring](x.h)) if not isNil(x.e): - pcre.free_study(x.e) + pcre.free_substring(cast[cstring](x.e)) proc re*(s: string, flags = {reStudy}): Regex = ## Constructor of regular expressions. |