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.390 by root, Thu Mar 31 01:36:58 2011 UTC vs.
Revision 1.391 by root, Thu Mar 31 04:24:19 2011 UTC

2008 2008
2009static void 2009static void
2010coro_call_on_destroy (pTHX_ struct coro *coro) 2010coro_call_on_destroy (pTHX_ struct coro *coro)
2011{ 2011{
2012 SV **on_destroyp = hv_fetch (coro->hv, "_on_destroy", sizeof ("_on_destroy") - 1, 0); 2012 SV **on_destroyp = hv_fetch (coro->hv, "_on_destroy", sizeof ("_on_destroy") - 1, 0);
2013 SV **statusp = hv_fetch (coro->hv, "_status", sizeof ("_status") - 1, 0);
2014 2013
2015 if (on_destroyp) 2014 if (on_destroyp)
2016 { 2015 {
2017 AV *on_destroy = (AV *)SvRV (*on_destroyp); 2016 SV **statusp = hv_fetch (coro->hv, "_status", sizeof ("_status") - 1, 0);
2017 AV *on_destroy = sv_2mortal (SvREFCNT_inc ((AV *)SvRV (*on_destroyp)));
2018 AV *status = statusp ? sv_2mortal (SvREFCNT_inc ((AV *)SvRV (*statusp))) : 0;
2018 2019
2019 while (AvFILLp (on_destroy) >= 0) 2020 while (AvFILLp (on_destroy) >= 0)
2020 { 2021 {
2021 dSP; /* don't disturb outer sp */ 2022 dSP; /* don't disturb outer sp */
2022 SV *cb = av_pop (on_destroy); 2023 SV *cb = av_pop (on_destroy);
2024 PUSHMARK (SP); 2025 PUSHMARK (SP);
2025 2026
2026 if (statusp) 2027 if (statusp)
2027 { 2028 {
2028 int i; 2029 int i;
2029 AV *status = (AV *)SvRV (*statusp);
2030 EXTEND (SP, AvFILLp (status) + 1); 2030 EXTEND (SP, AvFILLp (status) + 1);
2031 2031
2032 for (i = 0; i <= AvFILLp (status); ++i) 2032 for (i = 0; i <= AvFILLp (status); ++i)
2033 PUSHs (AvARRAY (status)[i]); 2033 PUSHs (AvARRAY (status)[i]);
2034 } 2034 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines