mro.c: Don’t inline sv_sethek
authorFather Chrysostomos <sprout@cpan.org>
Sun, 7 Sep 2014 00:38:29 +0000 (17:38 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 7 Sep 2014 06:00:57 +0000 (23:00 -0700)
This code actually long predates sv_sethek.  But now that we have it,
we can call it, reducing the size of mro.o.

mro.c

diff --git a/mro.c b/mro.c
index c9b40e5..5f7b939 100644 (file)
--- a/mro.c
+++ b/mro.c
@@ -307,19 +307,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, U32 level)
                        HEK *const key = HeKEY_hek(he);
 
                        HeVAL(he) = &PL_sv_undef;
-                       /* Save copying by making a shared hash key scalar. We
-                          inline this here rather than calling
-                          Perl_newSVpvn_share because we already have the
-                          scalar, and we already have the hash key.  */
-                       assert(SvTYPE(val) == SVt_NULL);
-                       sv_upgrade(val, SVt_PV);
-                       SvPV_set(val, HEK_KEY(share_hek_hek(key)));
-                       SvCUR_set(val, HEK_LEN(key));
-                       SvIsCOW_on(val);
-                       SvPOK_on(val);
-                       if (HEK_UTF8(key))
-                           SvUTF8_on(val);
-
+                       sv_sethek(val, key);
                        av_push(retval, val);
                    }
                }