This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Simplify the logic for retrieving PL_inplace into $^I, as sv_setpv()
authorNicholas Clark <nick@ccl4.org>
Thu, 18 Oct 2007 18:07:19 +0000 (18:07 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 18 Oct 2007 18:07:19 +0000 (18:07 +0000)
will do the "right" thing if we want NULL to map to undef.

p4raw-id: //depot/perl@32137

mg.c

diff --git a/mg.c b/mg.c
index 00b0c71..c4d7aeb 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -782,10 +782,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
        sv_setiv(sv, (IV)PL_hints);
        break;
     case '\011':               /* ^I */ /* NOT \t in EBCDIC */
-       if (PL_inplace)
-           sv_setpv(sv, PL_inplace);
-       else
-           sv_setsv(sv, &PL_sv_undef);
+       sv_setpv(sv, PL_inplace); /* Will undefine sv if PL_inplace is NULL */
        break;
     case '\017':               /* ^O & ^OPEN */
        if (nextchar == '\0') {