How can I push an AV * onto the stack?

[email protected] (Ben Bullock)
Newsgroups perl.xs
Message-ID <CAN5Y6m-Q=ubxxmW3OOzY_WUBXvPxEfuYWM5s0FjLRYazOB4LsQ@mail.gmail.com>
Is there a way to push an AV * onto the stack as an array?

Right now I have the following:

	if (wantarray) {
		EXTEND (SP, av_len (wantarray));
		for (i = 0; i <= av_len (wantarray); i++) {
			PUSHs (sv_2mortal (*(av_fetch (wantarray, i, 0))));
		}
        }

See:

https://github.com/benkasminbullock/Text-Fuzzy/blob/master/Fuzzy.xs#L163

Is there a better way to do it?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.