summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2006-04-11 09:14:45 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-05-03 16:24:04 +0000
commit5fcbf73de321a1551a1616d77c2f50a8a22d5f35 (patch)
treec66f4216a220aced9465a9d28f93ad7c1afa1bb3 /mg.c
parent16d5c2f8b1cda0f138e42178a21cad8ee16e6a20 (diff)
downloadperl-5fcbf73de321a1551a1616d77c2f50a8a22d5f35.tar.gz
more logic localizations
Message-ID: <20060411191445.GA4938@petdance.com> p4raw-id: //depot/perl@28081
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/mg.c b/mg.c
index 916d1cf7ed..7e7372d7f4 100644
--- a/mg.c
+++ b/mg.c
@@ -1668,7 +1668,7 @@ SV *
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));
@@ -1694,6 +1694,8 @@ Perl_magic_scalarpack(pTHX_ HV *hv, MAGIC *mg)
if (call_method("SCALAR", G_SCALAR))
retval = *PL_stack_sp--;
+ else
+ retval = &PL_sv_undef;
POPSTACK;
LEAVE;
return retval;
@@ -1901,7 +1903,7 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
{
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);
@@ -1915,11 +1917,12 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
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);