src/suspended_compcv.c

filter: Statementstmt 100% 26 / 26 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 28 / 28 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« hax/newMYCONSTSUB.c.inc ↑ Summary
1 /* vi: set ft=xs : */
2 #define PERL_NO_GET_CONTEXT
3  
4 #include "EXTERN.h"
5 #include "perl.h"
6 #include "XSUB.h"
7  
8 #include "suspended_compcv.h"
9  
10 #define HAVE_PERL_VERSION(R, V, S) \
11 (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
12  
13 #ifndef SAVESTRLEN
14 # if HAVE_PERL_VERSION(5,26,0)
15 # define SAVESTRLEN(i) Perl_save_strlen(aTHX_ (STRLEN *)&(i))
16 # else
17 /* perls before 5.26.0 had no STRLEN and used simply I32 here */
18 # define SAVESTRLEN(i) SAVEI32(i)
19 # endif
20 #endif
21  
22 295 void MY_suspend_compcv(pTHX_ SuspendedCompCVBuffer *buffer)
23 {
24 295 buffer->compcv = PL_compcv;
25  
26 295 buffer->padix = PL_padix;
27 #ifdef PL_constpadix
28 buffer->constpadix = PL_constpadix;
29 #endif
30 295 buffer->comppad_name_fill = PL_comppad_name_fill;
31 295 buffer->min_intro_pending = PL_min_intro_pending;
32 295 buffer->max_intro_pending = PL_max_intro_pending;
33  
34 295 buffer->cv_has_eval = PL_cv_has_eval;
35 295 buffer->pad_reset_pending = PL_pad_reset_pending;
36 295 }
37  
38 278 void MY_resume_compcv(pTHX_ SuspendedCompCVBuffer *buffer, bool save)
39 {
40 278 SAVESPTR(PL_compcv);
41 278 PL_compcv = buffer->compcv;
42 278 PAD_SET_CUR(CvPADLIST(PL_compcv), 1);
43  
44 278 SAVESPTR(PL_comppad_name);
45 278 PL_comppad_name = PadlistNAMES(CvPADLIST(PL_compcv));
46  
47 278 SAVESTRLEN(PL_padix); PL_padix = buffer->padix;
48 #ifdef PL_constpadix
49 SAVESTRLEN(PL_constpadix); PL_constpadix = buffer->constpadix;
50 #endif
51 278 SAVESTRLEN(PL_comppad_name_fill); PL_comppad_name_fill = buffer->comppad_name_fill;
52 278 SAVESTRLEN(PL_min_intro_pending); PL_min_intro_pending = buffer->min_intro_pending;
53 278 SAVESTRLEN(PL_max_intro_pending); PL_max_intro_pending = buffer->max_intro_pending;
54  
55 278 SAVEBOOL(PL_cv_has_eval);
56 278 PL_cv_has_eval = buffer->cv_has_eval;
57  
58 278 SAVEBOOL(PL_pad_reset_pending);
59 278 PL_pad_reset_pending = buffer->pad_reset_pending;
60  
61 278 ▶ if(save)
Branch: 1 branch
BranchTrueFalseTotal
if(save) 77 201 278
62 77 SAVEDESTRUCTOR_X(&MY_suspend_compcv, buffer);
63 278 }
« hax/newMYCONSTSUB.c.inc ↑ Summary