in reply to LoA from XS

The 'for' loop is not quite correct.
This rendition of it works for me:
for( j = 0; j <= av_len( av ); ++j ) { SV **sv2 = av_fetch( av, j, 0 ); char * str = SvPVX(*sv2); if(sv2 != NULL) printf( "[%d][%d] %x %d '%s'\n", i, j, *sv2, SvTYPE( *sv2 ), str ); }
Cheers,
Rob

Replies are listed 'Best First'.
Re^2: LoA from XS
by BrowserUk (Patriarch) on Apr 21, 2009 at 01:06 UTC

      Now I just need to undestand the changes.

      Two problems were fixed.

      • av_fetch returns a pointer to a SV* (which may be NULL). It needs to be dereferenced into a SV*, not casted to SV*.

      • Each element of the array is a string, not a reference to the string. The SvRV was extraneous.