On 2016-09-08 at 00:15 -0400, Phil Pennock wrote: > I've also pushed this code to a GitHub repo, philpennock/zsh-code on the > re2 branch: https://github.com/philpennock/zsh-code/tree/re2 This change is there too. > (Oh, I can't spell "tough", it seems; deferring fix for now). Fixed. Also fixed a bug described just below in the patch body, and swapped a FIXME comment for a TODO, referencing whatever future work changes =~ binding. (Feedback on that idea, outlined in previous mail, appreciated!) -Phil ----------------------------8< git patch >8----------------------------- The clean-up path is for an internal function being passed an id which it can't handle, but the ids come from this file, so it's protection against coding mistakes in future extension. In that hypothetical case, we'd leak the memory of one RE2 opt object each time the matching function was called in the unhandled id-profile. Also clean up two comments. --- Src/Modules/re2.c | 4 ++-- Test/V11re2.ztst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Src/Modules/re2.c b/Src/Modules/re2.c index e542723..f6a5283 100644 --- a/Src/Modules/re2.c +++ b/Src/Modules/re2.c @@ -28,7 +28,7 @@ */ /* This is heavily based upon my earlier regex module, with Peter's fixes - * for the tought stuff I had skipped / gotten wrong. */ + * for the tougher stuff I had skipped / gotten wrong. */ #include "re2.mdh" #include "re2.pro" @@ -106,7 +106,7 @@ zcond_re2_match(char **a, int id) break; default: DPUTS(1, "bad re2 option"); - goto CLEANUP_UNMETAONLY; + goto CLEANUP_OPT; } rex = cre2_new(rhre, strlen(rhre), opt); diff --git a/Test/V11re2.ztst b/Test/V11re2.ztst index d6e327c..823a5ef 100644 --- a/Test/V11re2.ztst +++ b/Test/V11re2.ztst @@ -7,7 +7,7 @@ fi # Load the rest of the builtins zmodload zsh/re2 - ##FIXME#setopt rematch_pcre + # TODO: use future mechanism to switch =~ to use re2 and test =~ too # Find a UTF-8 locale. setopt multibyte # Don't let LC_* override our choice of locale. -- 2.10.0