diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-11-24 11:36:36 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-11-24 11:36:36 +0000 |
commit | 15d9236d3878cc5033b0e89e4a2fc65f07146ea5 (patch) | |
tree | a4c482005bc6578c19cf64e74da08c1346ac3c5a /sv.c | |
parent | 68adb2b0c592afeb71b5a6a4f15af308d54a0db4 (diff) | |
download | perl-15d9236d3878cc5033b0e89e4a2fc65f07146ea5.tar.gz |
Convert xhv_name in struct xpvhv_aux to be a union of HEK* and HEK**
This avoids a lot of casting. Nothing outside the perl core code is accessing
that member directly.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -11819,30 +11819,32 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param) ++i; } if (SvOOK(sstr)) { - HEK *hvname; const struct xpvhv_aux * const saux = HvAUX(sstr); struct xpvhv_aux * const daux = HvAUX(dstr); /* This flag isn't copied. */ /* SvOOK_on(hv) attacks the IV flags. */ SvFLAGS(dstr) |= SVf_OOK; - hvname = saux->xhv_name; if (saux->xhv_name_count) { - HEK ** const sname = (HEK **)saux->xhv_name; + HEK ** const sname = saux->xhv_name_u.xhvnameu_name; const I32 count = saux->xhv_name_count < 0 ? -saux->xhv_name_count : saux->xhv_name_count; HEK **shekp = sname + count; HEK **dhekp; - Newxc(daux->xhv_name, count, HEK *, HEK); - dhekp = (HEK **)daux->xhv_name + count; + Newx(daux->xhv_name_u.xhvnameu_names, count, HEK *); + dhekp = daux->xhv_name_u.xhvnameu_names + count; while (shekp-- > sname) { dhekp--; *dhekp = hek_dup(*shekp, param); } } - else daux->xhv_name = hek_dup(hvname, param); + else { + daux->xhv_name_u.xhvnameu_name + = hek_dup(saux->xhv_name_u.xhvnameu_name, + param); + } daux->xhv_name_count = saux->xhv_name_count; daux->xhv_riter = saux->xhv_riter; |