scan_add_request.c

filter: Statementstmt 90.9% 20 / 22 Branchbran 60.0% 12 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 76.1% 32 / 42 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« scan_modify_request.c ↑ Summary scan_search_entry_response.c »
1 #include "scan.h"
2 #include <stdlib.h>
3  
4 void
5 2 scan_add_request(const char **src, const char* max, HV *out) {
6 STRLEN len;
7 SV *key;
8 2 SV *dn = newSV(0);
9 2 hv_stores(out, "dn", dn);
10 2 scan_string_utf8(src, max, dn);
11 2 ▶ scan_sequence(src, max, &len);
Branch: 2 branches
BranchTrueFalseTotal
scan_sequence(src, max, &len); 2 0 2
scan_sequence(src, max, &len); 2 0 2
12  
13 2 key = sv_newmortal();
14 4 ▶ while (*src < max) {
Branch: 1 branch
BranchTrueFalseTotal
while (*src < max) { 2 2 4
15 STRLEN attribute_len;
16 const char *attribute_max;
17 AV *values;
18 2 ▶ scan_sequence(src, max, &attribute_len);
Branch: 2 branches
BranchTrueFalseTotal
scan_sequence(src, max, &attribute_len); 2 0 2
scan_sequence(src, max, &attribute_len); 2 0 2
19 2 ▶ if (attribute_len > max - *src)
Branch: 1 branch
BranchTrueFalseTotal
if (attribute_len > max - *src) 0 2 2
20 0 croak("scan_add_request: packet too short");
21 2 attribute_max = *src + attribute_len;
22
23 2 scan_string_utf8(src, attribute_max, key);
24 2 ▶ scan_set(src, attribute_max, &attribute_len);
Branch: 2 branches
BranchTrueFalseTotal
scan_set(src, attribute_max, &attribute_len); 2 0 2
scan_set(src, attribute_max, &attribute_len); 2 0 2
25 2 ▶ if (attribute_len != attribute_max - *src)
Branch: 1 branch
BranchTrueFalseTotal
if (attribute_len != attribute_max - *src) 0 2 2
26 0 croak("scan_add_request: packet too short");
27  
28 2 values = newAV();
29 2 hv_store_ent(out, key, newRV_noinc((SV*)values), 0);
30  
31 6 ▶ while (*src < attribute_max) {
Branch: 1 branch
BranchTrueFalseTotal
while (*src < attribute_max) { 4 2 6
32 4 SV *v = newSV(0);
33 4 av_push(values, v);
34 4 scan_string_utf8(src, attribute_max, v);
35 }
36 }
37 2 }
38  
« scan_modify_request.c ↑ Summary scan_search_entry_response.c »