Use a general-purpose T_ARRAYREF_PTR typemap

This commit is contained in:
Alessandro Ranellucci 2013-09-09 21:43:28 +02:00
parent 1fbf9c3952
commit c592932cee

View File

@ -23,7 +23,7 @@ Lines T_ARRAYREF
Polygons T_ARRAYREF Polygons T_ARRAYREF
ExPolygons T_ARRAYREF ExPolygons T_ARRAYREF
Polygons* T_ARRAYREF_POLYGONS_PTR Polygons* T_ARRAYREF_PTR
INPUT INPUT
@ -56,12 +56,12 @@ T_ARRAYREF
} }
$var.clear(); $var.clear();
T_ARRAYREF_POLYGONS_PTR T_ARRAYREF_PTR
AV* av = newAV(); AV* av = newAV();
$arg = newRV_noinc((SV*)av); $arg = newRV_noinc((SV*)av);
sv_2mortal($arg); sv_2mortal($arg);
av_extend(av, $var->size()-1); av_extend(av, $var->size()-1);
int i = 0; int i = 0;
for (Polygons::iterator it = $var->begin(); it != $var->end(); ++it) { for (${ my $t = $type; $t =~ s/\*$//; \$t }::iterator it = $var->begin(); it != $var->end(); ++it) {
av_store(av, i++, (*it).to_SV_ref()); av_store(av, i++, (*it).to_SV_ref());
} }