Perl_magic_scalarpack(pTHX_ HV *hv, MAGIC *mg)
{
dVAR; dSP;
- SV *retval = &PL_sv_undef;
+ SV *retval;
SV * const tied = SvTIED_obj((SV*)hv, mg);
HV * const pkg = SvSTASH((SV*)SvRV(tied));
if (call_method("SCALAR", G_SCALAR))
retval = *PL_stack_sp--;
+ else
+ retval = &PL_sv_undef;
POPSTACK;
LEAVE;
return retval;
{
dVAR;
STRLEN len;
- const char *tmps = SvPV_const(sv, len);
+ const char * const tmps = SvPV_const(sv, len);
SV * const lsv = LvTARG(sv);
I32 lvoff = LvTARGOFF(sv);
I32 lvlen = LvTARGLEN(sv);
SvUTF8_on(lsv);
}
else if (lsv && SvUTF8(lsv)) {
+ const char *utf8;
sv_pos_u2b(lsv, &lvoff, &lvlen);
LvTARGLEN(sv) = len;
- tmps = (char*)bytes_to_utf8((U8*)tmps, &len);
- sv_insert(lsv, lvoff, lvlen, tmps, len);
- Safefree(tmps);
+ utf8 = (char*)bytes_to_utf8((U8*)tmps, &len);
+ sv_insert(lsv, lvoff, lvlen, utf8, len);
+ Safefree(utf8);
}
else {
sv_insert(lsv, lvoff, lvlen, tmps, len);