On Tue, Nov 23, 2004 at 07:32:56AM +0100 Tassilo von Parseval wrote:

[...]

>     void
>     _array_iterator ()
>         PROTOTYPE:
>         CODE:
>         {
>             register int i;
>             int exhausted = 1;
>             int len;
>             closure_args *args = (closure_args*)CvXSUBANY(cv).any_ptr;
> 
>             for (i = 0; i < args->narrays; i++) {
>                 AV *av = args->arrays[i];
>                 if (args->curidx <= av_len(av)) {
>                     ST(i) = *av_fetch(args->arrays[i], args->curidx, FALSE);
>                     exhausted = 0;
>                     continue;
>                 }
>                 ST(i) = &PL_sv_undef;
>                 
>             }
> 
>             if (exhausted) {
>                 Safefree(args->arrays);
>                 Safefree(args);
>                 XSRETURN_EMPTY;
>             }
> 
>             args->curidx++;
>             XSRETURN(len);
>         }

[...]

> Another thing of concern is that it doesn't yet work on perl5.005_04
> (the only other version I checked). It compiles fine and runs without
> segfaults and such, it just produces no output at all. I don't see any
> perl5.8.5isms in the above. 

Alright, I was just stupid. I am doing 'XSRETURN(len)' but never
initialized 'len'. Changing that to 'XSRETURN(args->narrays)' would have
been much better. Also, I probably shouldn't assign to 'ST(i)' without
assuring that the stack is long enough.

Anyway, I am happy now.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval

Reply via email to