ScopedVariables.xs

filter: Statementstmt 80.0% 8 / 10 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 75.0% 12 / 16 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary blib/lib/Devel/CCompat/C99/ScopedVariables.pm »
1 #define PERL_NO_GET_CONTEXT
2 #include "EXTERN.h"
3 #include "perl.h"
4 #include "XSUB.h"
5 #include "ppport.h"
6  
7 /* C functions */
8 int
9 1 use_scoped_variable(int size)
10 {
11 1 ▶ if (size < 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (size < 1) { 0 1 1
12 0 size = -size;
13 }
14  
15 1 int x = 0;
16 11 ▶ for(int i=0; i< size; ++i) {
Branch: 1 branch
BranchTrueFalseTotal
for(int i=0; i< size; ++i) { 10 1 11
17 10 x += i;
18 }
19  
20 1 return x;
21 }
22  
23 MODULE = Devel::CCompat::C99::ScopedVariables PACKAGE = Devel::CCompat::C99::ScopedVariables
24 PROTOTYPES: DISABLE
25  
26 # XS code
27  
28 int
29 create_scoped_variable(int size)
30 CODE:
31 1 ▶ if(size <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(size <= 0) { 0 1 1
32 0 croak("size must be positive\n");
33 }
34 1 RETVAL = use_scoped_variable(size);
35 OUTPUT: RETVAL
36  
↑ Summary blib/lib/Devel/CCompat/C99/ScopedVariables.pm »