summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-11-14 11:18:57 -0700
committerKarl Williamson <khw@cpan.org>2014-11-20 21:45:18 -0700
commitad2de1b2b22db677f46346aac18927b2032d7a68 (patch)
treeb1cc07a52e57c44db48737ac6b646fdf30906b5f /mg.c
parent47e13f24847018e7947377141de64798abfa1ce9 (diff)
downloadperl-ad2de1b2b22db677f46346aac18927b2032d7a68.tar.gz
Make a function to get PL_encoding's value
This is in preparation for making the retrieval more complex in future commits than it is now. This is going into mg.c because the value is magical.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index c49b146cd4..223461e7a2 100644
--- a/mg.c
+++ b/mg.c
@@ -767,6 +767,14 @@ S_fixup_errno_string(pTHX_ SV* sv)
}
}
+SV*
+Perl__get_encoding(pTHX)
+{
+ /* Returns the $^ENCODING or 'use encoding' in effect; NULL if none */
+
+ return PL_encoding;
+}
+
#ifdef VMS
#include <descrip.h>
#include <starlet.h>
@@ -817,7 +825,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
case '\005': /* ^E */
if (nextchar != '\0') {
if (strEQ(remaining, "NCODING"))
- sv_setsv(sv, PL_encoding);
+ sv_setsv(sv, _get_encoding());
break;
}