pack_raw.c

filter: Statementstmt 50.9% 26 / 51 Branchbran 45.8% 11 / 24 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 49.3% 37 / 75 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« pack_bind_request.c ↑ Summary pack_search_reference_response.c »
1 #include "pack.h"
2 #include "util.h"
3  
4 void
5 0 pack_raw_pvn(SV* dest, U8 type, U32 tag, const char* c, STRLEN l) {
6 0 pack_tag(dest, type, tag);
7 0 pack_length(dest, l);
8 0 ▶ if (l)
Branch: 1 branch
BranchTrueFalseTotal
if (l) 0 0 0
9 0 sv_catpvn(dest, c, l);
10 0 }
11  
12 void
13 0 pack_raw_pvn_notag(SV *dest, const char* c, STRLEN l) {
14 0 pack_length(dest, l);
15 0 sv_catpvn(dest, c, l);
16 0 }
17  
18 void
19 0 pack_raw(SV* dest, U8 type, U32 tag, SV *sv) {
20 0 pack_tag(dest, type, tag);
21 0 ▶ if (sv) {
Branch: 1 branch
BranchTrueFalseTotal
if (sv) { 0 0 0
22 STRLEN len;
23 const char *pv;
24 0 sv_utf8_downgrade(sv, 0);
25 0 pv = SvPV(sv, len);
26 0 ▶ if (len) {
Branch: 1 branch
BranchTrueFalseTotal
if (len) { 0 0 0
27 0 pack_length(dest, len);
28 0 sv_catpvn(dest, pv, len);
29 0 return;
30 }
31 }
32 0 pack_length(dest, 0);
33 }
34  
35 void
36 90 pack_raw_utf8(SV* dest, U8 type, U32 tag, SV *sv) {
37 90 pack_tag(dest, type, tag);
38 90 ▶ if (sv) {
Branch: 1 branch
BranchTrueFalseTotal
if (sv) { 90 0 90
39 STRLEN len;
40 90 const char *pv = SvPVutf8(sv, len);
41 90 ▶ if (len) {
Branch: 1 branch
BranchTrueFalseTotal
if (len) { 89 1 90
42 89 pack_length(dest, len);
43 89 sv_catpvn(dest, pv, len);
44 89 return;
45 }
46 }
47 1 pack_length(dest, 0);
48 }
49  
50 void
51 0 pack_array_of_raw_utf8_v(SV *dest, U8 type, U32 tag, SV **args, I32 n) {
52 I32 i;
53 0 ▶ for (i = 0; i < n; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < n; i++) 0 0 0
54 0 pack_raw_utf8(dest, type, tag, args[i]);
55 0 }
56  
57 void
58 13 pack_array_of_raw_utf8(SV *dest, U8 type, U32 tag, SV *sv) {
59 AV *av;
60 13 ▶ if (sv && SvOK(sv)) {
Branch: 2 branches
BranchTrueFalseTotal
if (sv && SvOK(sv)) { 13 0 13
if (sv && SvOK(sv)) { 11 2 13
61 22 ▶ if (SvROK(sv) && (av = (AV*)SvRV(sv)) && (SvTYPE((SV*)av) == SVt_PVAV)) {
Branch: 3 branches
BranchTrueFalseTotal
if (SvROK(sv) && (av = (AV*)SvRV(sv)) && (SvTYPE((SV*)av) == SVt_PVAV)) { 11 0 11
if (SvROK(sv) && (av = (AV*)SvRV(sv)) && (SvTYPE((SV*)av) == SVt_PVAV)) { 11 0 11
if (SvROK(sv) && (av = (AV*)SvRV(sv)) && (SvTYPE((SV*)av) == SVt_PVAV)) { 11 0 11
62 11 U32 i, size = av_len(av) + 1;
63 31 ▶ for (i = 0; i < size; i++)
Branch: 1 branch
BranchTrueFalseTotal
for (i = 0; i < size; i++) 20 11 31
64 20 pack_raw_utf8(dest, type, tag, av_fetch_def_undef(av, i));
65 }
66 else
67 0 pack_raw_utf8(dest, type, tag, sv);
68 }
69 13 }
70  
71 void
72 3 pack_sequence_of_raw_utf8(SV *dest, U8 type, U32 tag, SV *sv) {
73 3 STRLEN offset = start_sequence(dest);
74 3 pack_array_of_raw_utf8(dest, type, tag, sv);
75 3 end_sequence(dest, offset);
76 3 }
77  
78 void
79 7 pack_set_of_raw_utf8(SV *dest, U8 type, U32 tag, SV *sv) {
80 7 STRLEN offset = start_set(dest);
81 7 pack_array_of_raw_utf8(dest, type, tag, sv);
82 7 end_set(dest, offset);
83 7 }
« pack_bind_request.c ↑ Summary pack_search_reference_response.c »