summaryrefslogtreecommitdiff
path: root/cpan/Encode/Encode.xs
diff options
context:
space:
mode:
Diffstat (limited to 'cpan/Encode/Encode.xs')
-rw-r--r--cpan/Encode/Encode.xs5
1 files changed, 4 insertions, 1 deletions
diff --git a/cpan/Encode/Encode.xs b/cpan/Encode/Encode.xs
index 18c982ac47..e08101add5 100644
--- a/cpan/Encode/Encode.xs
+++ b/cpan/Encode/Encode.xs
@@ -47,8 +47,11 @@ Encode_XSEncoding(pTHX_ encode_t * enc)
SV *iv = newSViv(PTR2IV(enc));
SV *sv = sv_bless(newRV_noinc(iv),stash);
int i = 0;
+ /* with the SvLEN() == 0 hack, PVX won't be freed. We cast away name's
+ constness, in the hope that perl won't mess with it. */
+ assert(SvTYPE(iv) >= SVt_PV); assert(SvLEN(iv) == 0);
SvFLAGS(iv) |= SVp_POK;
- SvPVX(iv) = enc->name[0];
+ SvPVX(iv) = (char*) enc->name[0];
PUSHMARK(sp);
XPUSHs(sv);
while (enc->name[i]) {