diff --git a/Byte/Makefile.PL b/Byte/Makefile.PL index e368ac8..550f4e0 100644 --- a/Byte/Makefile.PL +++ b/Byte/Makefile.PL @@ -114,12 +114,15 @@ END print XS <<"END"; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) diff --git a/CN/Makefile.PL b/CN/Makefile.PL index 323b47e..ce30dcd 100644 --- a/CN/Makefile.PL +++ b/CN/Makefile.PL @@ -90,12 +90,15 @@ END print XS <<"END"; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) diff --git a/EBCDIC/Makefile.PL b/EBCDIC/Makefile.PL index 1c78c6a..2073536 100644 --- a/EBCDIC/Makefile.PL +++ b/EBCDIC/Makefile.PL @@ -71,12 +71,15 @@ END print XS <<"END"; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) diff --git a/Encode.pm b/Encode.pm index e9779e7..3c1f912 100644 --- a/Encode.pm +++ b/Encode.pm @@ -4,7 +4,7 @@ package Encode; use strict; use warnings; -our $VERSION = sprintf "%d.%02d", q$Revision: 2.57 $ =~ /(\d+)/g; +our $VERSION = sprintf "%d.%02d", q$Revision: 2.58 $ =~ /(\d+)/g; use constant DEBUG => !!$ENV{PERL_ENCODE_DEBUG}; use XSLoader (); XSLoader::load( __PACKAGE__, $VERSION ); diff --git a/Encode.xs b/Encode.xs index ea9265f..7133ce2 100644 --- a/Encode.xs +++ b/Encode.xs @@ -41,12 +41,15 @@ UNIMPLEMENTED(_encoded_bytes_to_utf8, I32) UTF8_ALLOW_LONG)) void -Encode_XSEncoding(pTHX_ encode_t * enc) +Encode_XSEncoding(pTHX_ encode_t * enc, char * name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))), stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) { diff --git a/Encode/Makefile_PL.e2x b/Encode/Makefile_PL.e2x index 9fe60ef..54cab03 100644 --- a/Encode/Makefile_PL.e2x +++ b/Encode/Makefile_PL.e2x @@ -107,12 +107,15 @@ END print XS <<"END"; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) diff --git a/JP/Makefile.PL b/JP/Makefile.PL index c6a725f..39826e1 100644 --- a/JP/Makefile.PL +++ b/JP/Makefile.PL @@ -90,12 +90,15 @@ END print XS <<"END"; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) diff --git a/KR/Makefile.PL b/KR/Makefile.PL index 49c0319..0a694a4 100644 --- a/KR/Makefile.PL +++ b/KR/Makefile.PL @@ -88,12 +88,15 @@ END print XS <<"END"; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) diff --git a/Symbol/Makefile.PL b/Symbol/Makefile.PL index 2c94aab..5410d8a 100644 --- a/Symbol/Makefile.PL +++ b/Symbol/Makefile.PL @@ -76,12 +76,15 @@ END print XS <<"END"; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) diff --git a/TW/Makefile.PL b/TW/Makefile.PL index f90861f..ee1ebb1 100644 --- a/TW/Makefile.PL +++ b/TW/Makefile.PL @@ -86,12 +86,15 @@ END print XS <<"END"; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i]) diff --git a/bin/enc2xs b/bin/enc2xs index c5f788d..57ba1da 100755 --- a/bin/enc2xs +++ b/bin/enc2xs @@ -10,7 +10,7 @@ use warnings; use Getopt::Std; use Config; my @orig_ARGV = @ARGV; -our $VERSION = do { my @r = (q$Revision: 2.9 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; +our $VERSION = do { my @r = (q$Revision: 2.10 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # These may get re-ordered. # RAW is a do_now as inserted by &enter @@ -301,7 +301,7 @@ if ($doC) my $sym = "${enc}_encoding"; $sym =~ s/\W+/_/g; print H "extern encode_t $sym;\n"; - print D " Encode_XSEncoding(aTHX_ &$sym);\n"; + print D " Encode_XSEncoding(aTHX_ &$sym, \"$sym\");\n"; } if ($cname =~ /(\w+)\.xs$/) @@ -310,12 +310,15 @@ if ($doC) print C <<'END'; static void -Encode_XSEncoding(pTHX_ encode_t *enc) +Encode_XSEncoding(pTHX_ encode_t *enc, char *name) { dSP; HV *stash = gv_stashpv("Encode::XS", TRUE); - SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash); + SV *iv = newSViv(PTR2IV(enc)); + SV *sv = sv_bless(newRV_noinc(iv),stash); int i = 0; + SvFLAGS(iv) |= SVp_POK; + SvPVX(iv) = name; PUSHMARK(sp); XPUSHs(sv); while (enc->name[i])