VariableLengthArrays.xs

filter: Statementstmt 88.8% 8 / 9 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 84.6% 11 / 13 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary blib/lib/Devel/CCompat/C99/VariableLengthArrays.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_var_len_array(int size)
10 1 {
11 1 int array[size];
12 int i;
13  
14 11 ▶ for(i=0; i< size; ++i) {
Branch: 1 branch
BranchTrueFalseTotal
for(i=0; i< size; ++i) { 10 1 11
15 10 array[i] = (i*2)+1;
16 }
17  
18 1 return array[size/2];
19 }
20  
21 MODULE = Devel::CCompat::C99::VariableLengthArrays PACKAGE = Devel::CCompat::C99::VariableLengthArrays
22 PROTOTYPES: DISABLE
23  
24 # XS code
25  
26 int
27 create_array(int size)
28 CODE:
29 1 ▶ if(size <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(size <= 0) { 0 1 1
30 0 croak("size must be positive\n");
31 }
32 1 RETVAL = use_var_len_array(size);
33 OUTPUT: RETVAL
34  
↑ Summary blib/lib/Devel/CCompat/C99/VariableLengthArrays.pm »