xs/custom.c

filter: Statementstmt 100% 31 / 31 Branchbran 60.0% 12 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 84.3% 43 / 51 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« xs/record_opaque.c ↑ Summary xs/closure.c »
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4 #include "ppport.h"
5 #include "ffi_platypus.h"
6 #include "ffi_platypus_guts.h"
7  
8 SV*
9 234 ffi_pl_custom_perl(SV *subref, SV *in_arg, int i)
10 {
11 234 ▶ if(subref == NULL)
Branch: 1 branch
BranchTrueFalseTotal
if(subref == NULL) 37 197 234
12 {
13 37 return newSVsv(in_arg);
14 }
15 else
16 {
17 197 dSP;
18  
19 int count;
20 SV *out_arg;
21  
22 197 ENTER;
23 197 SAVETMPS;
24 197 ▶ PUSHMARK(SP);
Branch: 1 branch
BranchTrueFalseTotal
PUSHMARK(SP); 0 197 197
25 197 ▶ XPUSHs(in_arg);
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(in_arg); 0 197 197
26 197 ▶ XPUSHs(sv_2mortal(newSViv(i)));
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(sv_2mortal(newSViv(i))); 0 197 197
27 197 PUTBACK;
28  
29 197 count = call_sv(subref, G_ARRAY);
30  
31 186 SPAGAIN;
32  
33 186 ▶ if(count >= 1)
Branch: 1 branch
BranchTrueFalseTotal
if(count >= 1) 177 9 186
34 177 out_arg = SvREFCNT_inc(POPs);
35 else
36 9 out_arg = NULL;
37  
38 186 PUTBACK;
39 186 ▶ FREETMPS;
Branch: 1 branch
BranchTrueFalseTotal
FREETMPS; 186 0 186
40 186 LEAVE;
41  
42 186 return out_arg;
43 }
44 }
45  
46 void
47 85 ffi_pl_custom_perl_cb(SV *subref, SV *in_arg, int i)
48 {
49 85 dSP;
50 85 ENTER;
51 85 SAVETMPS;
52 85 ▶ PUSHMARK(SP);
Branch: 1 branch
BranchTrueFalseTotal
PUSHMARK(SP); 0 85 85
53 85 ▶ XPUSHs(in_arg);
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(in_arg); 0 85 85
54 85 ▶ XPUSHs(sv_2mortal(newSViv(i)));
Branch: 1 branch
BranchTrueFalseTotal
XPUSHs(sv_2mortal(newSViv(i))); 0 85 85
55 85 PUTBACK;
56 85 call_sv(subref, G_VOID|G_DISCARD);
57 84 ▶ FREETMPS;
Branch: 1 branch
BranchTrueFalseTotal
FREETMPS; 84 0 84
58 84 LEAVE;
59 84 }
« xs/record_opaque.c ↑ Summary xs/closure.c »