ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/State.xs
(Generate patch)

Comparing Coro/Coro/State.xs (file contents):
Revision 1.433 by root, Thu May 9 05:40:14 2013 UTC vs.
Revision 1.434 by root, Sat Nov 2 19:48:50 2013 UTC

26#ifndef SVs_PADSTALE 26#ifndef SVs_PADSTALE
27# define SVs_PADSTALE 0 27# define SVs_PADSTALE 0
28#endif 28#endif
29 29
30#ifdef PadARRAY 30#ifdef PadARRAY
31# define NEWPADAPI 31# define NEWPADAPI 1
32# define newPADLIST(var) (Newz (0, var, 1, PADLIST), Newx (PadlistARRAY (var), 2, PAD *)) 32# define newPADLIST(var) (Newz (0, var, 1, PADLIST), Newx (PadlistARRAY (var), 2, PAD *))
33#else 33#else
34typedef AV PADNAMELIST; 34typedef AV PADNAMELIST;
35# if !PERL_VERSION_ATLEAST(5,8,0) 35# if !PERL_VERSION_ATLEAST(5,8,0)
36typedef AV PADLIST; 36typedef AV PADLIST;
511coro_derive_padlist (pTHX_ CV *cv) 511coro_derive_padlist (pTHX_ CV *cv)
512{ 512{
513 PADLIST *padlist = CvPADLIST (cv); 513 PADLIST *padlist = CvPADLIST (cv);
514 PADLIST *newpadlist; 514 PADLIST *newpadlist;
515 PAD *newpad; 515 PAD *newpad;
516 PADOFFSET const off = PadlistMAX (padlist) + 1; 516 PADOFFSET off = PadlistMAX (padlist) + 1;
517 517
518 newPADLIST(newpadlist); 518#if NEWPADAPI
519#if !PERL_VERSION_ATLEAST(5,15,3) 519
520 /* Padlists are AvREAL as of 5.15.3. See perl bug #98092 and perl commit 7d953ba. */ 520 while (!PadlistARRAY (padlist)[off - 1])
521 AvREAL_off (newpadlist); 521 --off;
522#endif 522
523 Perl_pad_push (aTHX_ padlist, off);
524 newpad = PadlistARRAY (padlist)[off];
525 PadlistARRAY (padlist)[off] = 0;
526
527#else
528
523#if PERL_VERSION_ATLEAST (5,10,0) 529#if PERL_VERSION_ATLEAST (5,10,0)
524 Perl_pad_push (aTHX_ padlist, off); 530 Perl_pad_push (aTHX_ padlist, off);
525#else 531#else
526 Perl_pad_push (aTHX_ padlist, off, 1); 532 Perl_pad_push (aTHX_ padlist, off, 1);
527#endif 533#endif
534
528 newpad = PadlistARRAY (padlist)[off]; 535 newpad = PadlistARRAY (padlist)[off];
529 PadlistMAX (padlist) = off - 1; 536 PadlistMAX (padlist) = off - 1;
537
538#endif
539
540 newPADLIST (newpadlist);
541#if !PERL_VERSION_ATLEAST(5,15,3)
542 /* Padlists are AvREAL as of 5.15.3. See perl bug #98092 and perl commit 7d953ba. */
543 AvREAL_off (newpadlist);
544#endif
530 545
531 /* Already extended to 2 elements by newPADLIST. */ 546 /* Already extended to 2 elements by newPADLIST. */
532 PadlistMAX (newpadlist) = 1; 547 PadlistMAX (newpadlist) = 1;
533 PadlistNAMES (newpadlist) = (PADNAMELIST *)SvREFCNT_inc_NN (PadlistNAMES (padlist)); 548 PadlistNAMES (newpadlist) = (PADNAMELIST *)SvREFCNT_inc_NN (PadlistNAMES (padlist));
534 PadlistARRAY (newpadlist)[1] = newpad; 549 PadlistARRAY (newpadlist)[1] = newpad;
557 SvREFCNT_dec (pad); 572 SvREFCNT_dec (pad);
558 } 573 }
559 574
560 SvREFCNT_dec (PadlistNAMES (padlist)); 575 SvREFCNT_dec (PadlistNAMES (padlist));
561 576
562#ifdef NEWPADAPI 577#if NEWPADAPI
563 Safefree (PadlistARRAY (padlist)); 578 Safefree (PadlistARRAY (padlist));
564 Safefree (padlist); 579 Safefree (padlist);
565#else 580#else
566 AvFILLp (padlist) = -1; 581 AvFILLp (padlist) = -1;
567 AvREAL_off (padlist); 582 AvREAL_off (padlist);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines