This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Copy some safeguards from swash_init()
authorKarl Williamson <khw@cpan.org>
Fri, 19 Apr 2019 16:56:48 +0000 (10:56 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 19 Apr 2019 17:03:23 +0000 (11:03 -0600)
Moving \p{user-defined} into core C code instead of utf8_heavy.pl
removes it from using swash_init(), instead calling the user sub
directly.  At the suggestion of Tony Cook, this commit cargo cults some
precautions that swash_init() did before calling utf8_heavy (which in
turn called the user sub).  Some of these make sense, but some we're
doing because swash_init() did, and presumably it had reasons to.  (git
blame doesn't really help).

regcomp.c

index 150e9a9..fbd5c18 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -23247,6 +23247,16 @@ Perl_parse_uniprop_string(pTHX_
             XPUSHs(boolSV(to_fold));
             PUTBACK;
 
+            /* The following block was taken from swash_init().  Presumably
+             * they apply to here as well, though we no longer use a swash --
+             * khw */
+            SAVEHINTS();
+            save_re_context();
+            /* We might get here via a subroutine signature which uses a utf8
+             * parameter name, at which point PL_subname will have been set
+             * but not yet used. */
+            save_item(PL_subname);
+
             (void) call_sv(user_sub_sv, G_EVAL|G_SCALAR);
 
             SPAGAIN;