Hi,

Muppet wrote:


On Sep 15, 2004, at 11:42 AM, Reinhard Pagitsch wrote:

If I populate an array with av_push will the SV* val a copy in the array or it is only a reference to it?


av_make() copies the svs you give it, but none of the other av functions do. av_store() and av_push() both store in the av the actual pointers you give to them, which means they basically own the svs.

if in doubt, see Perl_av_store() in perl/av.c; near the end, the line ary[key] = val is where the pointer passed as an arg is stored in the internal data structure. val's refcount is never touched.

Thank you for the information. What have I to do now? With av_make I have to know how many SV's will be stored.
But I do not know it at this time. Is the way I do it now the correct one?
BTW is there a XS function like the strtok() in C or the split() in Perl? I did not find one in the Activestate documentation.
I tryed the strtok() function but Perl crashes.


Thank you,
Reinhard

--




Reply via email to