This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
I'm not convinced that manually creating HVs via sv_upgrade is a great
authorNicholas Clark <nick@ccl4.org>
Thu, 16 Jun 2005 15:09:00 +0000 (15:09 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 16 Jun 2005 15:09:00 +0000 (15:09 +0000)
idea, but as we are, turning on shared keys makes sense.

p4raw-id: //depot/perl@24874

util.c

diff --git a/util.c b/util.c
index 67d27d7..004d493 100644 (file)
--- a/util.c
+++ b/util.c
@@ -3832,6 +3832,9 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv)
     AV *av = newAV();
     SV* hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
     (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */
+#ifndef NODEFAULT_SHAREKEYS
+    HvSHAREKEYS_on(hv);         /* key-sharing on by default */
+#endif
 
     if (*s == 'v') {
        s++;  /* get past 'v' */
@@ -3988,6 +3991,9 @@ Perl_new_version(pTHX_ SV *ver)
        /* This will get reblessed later if a derived class*/
        SV* hv = newSVrv(rv, "version"); 
        (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */
+#ifndef NODEFAULT_SHAREKEYS
+       HvSHAREKEYS_on(hv);         /* key-sharing on by default */
+#endif
 
        if ( SvROK(ver) )
            ver = SvRV(ver);