This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
pad.c: Don’t copy shared hash key targets when cloning
authorFather Chrysostomos <sprout@cpan.org>
Wed, 3 Jul 2013 01:25:48 +0000 (18:25 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 26 Jul 2013 06:48:02 +0000 (23:48 -0700)
When creating a new thread, don’t treat shared hash key targets as
constants.  (See the previous commit for explanation.)

This should cause no change in behaviour, because the new target will
not be in use, and its next use will immediately overwrite its value.
It just saves having to copy a string that will be overwritten.

pad.c

diff --git a/pad.c b/pad.c
index e44083b..082dc66 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -2445,7 +2445,7 @@ Perl_padlist_dup(pTHX_ PADLIST *srcpad, CLONE_PARAMS *param)
                        }
                    }
                }
                        }
                    }
                }
-               else if (IS_PADGV(oldpad[ix]) || IS_PADCONST(oldpad[ix])) {
+               else if (IS_PADGV(oldpad[ix]) || PadnamePV(names[ix])) {
                    pad1a[ix] = sv_dup_inc(oldpad[ix], param);
                }
                else {
                    pad1a[ix] = sv_dup_inc(oldpad[ix], param);
                }
                else {