histo_perl_interf.h

filter: Statementstmt 100% 10 / 10 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 12 / 12 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« XS/rdgen.xs ↑ Summary
1 #ifndef histo_perl_interf_h_
2 #define histo_perl_interf_h_
3  
4 /* This file is purely for inclusion in the XS and defines
5 * (STATIC) functions for C-histogram <=> Perl interfacing
6 */
7  
8 STATIC
9 SV*
10 62 histo_ary_to_AV_internal(pTHX_ unsigned int n, double* ary) {
11 AV* av;
12 unsigned int i;
13 SV* rv;
14  
15 62 av = newAV();
16 62 rv = (SV*)newRV((SV*)av);
17 62 SvREFCNT_dec(av);
18  
19 62 av_fill(av, n-1);
20 820 ▶ for (i = 0; i < n; ++i) {
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < n; ++i) { 758 62 820
21 758 av_store(av, (int)i, newSVnv(ary[i]));
22 }
23  
24 62 return rv;
25 }
26  
27 STATIC
28 SV*
29 histo_data_av(pTHX_ simple_histo_1d* self) {
30 57 return histo_ary_to_AV_internal(aTHX_ self->nbins, self->data);
31 }
32  
33 STATIC
34 SV*
35 histo_bins_av(pTHX_ simple_histo_1d* self) {
36 5 return histo_ary_to_AV_internal(aTHX_ self->nbins+1, self->bins);
37 }
38  
39  
40 #endif
« XS/rdgen.xs ↑ Summary