[perl5] Use sv_setpvn() to set a scalar from a pointer and length

- patch from SF#174460 by "matsubaray".


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9937 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2007-09-17 23:24:11 +00:00
commit e2d7f303b8
6 changed files with 28 additions and 13 deletions

View file

@ -28,10 +28,9 @@ SWIG_From_dec(jstring)(jstring val)
if (!len) {
sv_setsv(obj, &PL_sv_undef);
} else {
char *tmp = %new_array(len + 1, char);
char *tmp = %new_array(len, char);
JvGetStringUTFRegion(val, 0, len, tmp);
tmp[len] = 0;
sv_setpv(obj, tmp);
sv_setpvn(obj, tmp, len);
SvUTF8_on(obj);
%delete_array(tmp);
}