dankogai / p5-encode

Encode - character encodings (for Perl 5.8 or better)
https://metacpan.org/release/Encode
37 stars 51 forks source link

Fix handling of undef, ref, typeglob, UTF8, COW and magic scalar argument in all XS functions #70

Closed pali closed 8 years ago

pali commented 8 years ago

Before this patch every function XS function did it differently and not every one correctly. Now SvPV_force_nomg() is used when source argument is going to be modified. SvGETMAGIC() is called when entering into functions and then only "nomg" variants of perl functions are used to prevent processing get magic more times. SvSETMAGIC() is called after modification of source argument.

This fixes bugs: https://rt.cpan.org/Public/Bug/Display.html?id=117158 https://rt.cpan.org/Public/Bug/Display.html?id=85489 https://github.com/dankogai/p5-encode/pull/66

See discussion about this patch, Father Chrysostomos reviewed it: http://code.activestate.com/lists/perl5-porters/233137/ http://www.nntp.perl.org/group/perl.perl5.porters/2016/10/msg240511.html


Now magic scalars should be handled correctly by Encode.xs functions.

dankogai commented 8 years ago

Thank you!