Also avoid calling into he_dup when the HE is 0, to save the function
call overhead.
p4raw-id: //depot/perl@24662
if (HvARRAY((HV*)sstr)) {
STRLEN i = 0;
if (HvARRAY((HV*)sstr)) {
STRLEN i = 0;
+ bool sharekeys = !!HvSHAREKEYS(sstr);
XPVHV *dxhv = (XPVHV*)SvANY(dstr);
XPVHV *sxhv = (XPVHV*)SvANY(sstr);
char *darray;
XPVHV *dxhv = (XPVHV*)SvANY(dstr);
XPVHV *sxhv = (XPVHV*)SvANY(sstr);
char *darray;
- /* FIXME - surely this doesn't need to be zeroed? */
- Newz(0, darray,
PERL_HV_ARRAY_ALLOC_BYTES(dxhv->xhv_max+1)
+ (SvOOK(sstr) ? sizeof(struct xpvhv_aux) : 0), char);
HvARRAY(dstr) = (HE**)darray;
while (i <= sxhv->xhv_max) {
PERL_HV_ARRAY_ALLOC_BYTES(dxhv->xhv_max+1)
+ (SvOOK(sstr) ? sizeof(struct xpvhv_aux) : 0), char);
HvARRAY(dstr) = (HE**)darray;
while (i <= sxhv->xhv_max) {
+ HE *source = HvARRAY(sstr)[i];
- = he_dup(HvARRAY(sstr)[i],
- (bool)!!HvSHAREKEYS(sstr), param);
+ = source ? he_dup(source, sharekeys, param) : 0;
++i;
}
if (SvOOK(sstr)) {
++i;
}
if (SvOOK(sstr)) {