OpenCoverage

pqueue.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/ssl/pqueue.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3struct pqueue_st {-
4 pitem *items;-
5 int count;-
6};-
7-
8pitem *pitem_new(unsigned char *prio64be, void *data)-
9{-
10 pitem *item = CRYPTO_malloc(sizeof(*item), __FILE__, 20);-
11-
12 if (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2250 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2250
13 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 2250 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-2250
14 ) {-
15 ERR_put_error(20,(624),((1|64)),__FILE__,23);-
16 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
17 ((void *)0)
never executed: return ((void *)0) ;
0
18 ;
never executed: return ((void *)0) ;
0
19 }-
20-
21 memcpy(item->priority, prio64be, sizeof(item->priority));-
22 item->data = data;-
23 item->next = -
24 ((void *)0)-
25 ;-
26 return
executed 2250 times by 1 test: return item;
Executed by:
  • libssl.so.1.1
item;
executed 2250 times by 1 test: return item;
Executed by:
  • libssl.so.1.1
2250
27}-
28-
29void pitem_free(pitem *item)-
30{-
31 CRYPTO_free(item, __FILE__, 35);-
32}
executed 2250 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2250
33-
34pqueue *pqueue_new(void)-
35{-
36 pqueue *pq = CRYPTO_zalloc(sizeof(*pq), __FILE__, 40);-
37-
38 if (pq ==
pq == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1865 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1865
39 ((void *)0)
pq == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1865 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-1865
40 )-
41 ERR_put_error(20,(625),((1|64)),__FILE__,43);
never executed: ERR_put_error(20,(625),((1|64)),__FILE__,43);
0
42-
43 return
executed 1865 times by 1 test: return pq;
Executed by:
  • libssl.so.1.1
pq;
executed 1865 times by 1 test: return pq;
Executed by:
  • libssl.so.1.1
1865
44}-
45-
46void pqueue_free(pqueue *pq)-
47{-
48 CRYPTO_free(pq, __FILE__, 50);-
49}
executed 1865 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
1865
50-
51pitem *pqueue_insert(pqueue *pq, pitem *item)-
52{-
53 pitem *curr, *next;-
54-
55 if (pq->items ==
pq->items == ((void *)0)Description
TRUEevaluated 1068 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1182 times by 1 test
Evaluated by:
  • libssl.so.1.1
1068-1182
56 ((void *)0)
pq->items == ((void *)0)Description
TRUEevaluated 1068 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1182 times by 1 test
Evaluated by:
  • libssl.so.1.1
1068-1182
57 ) {-
58 pq->items = item;-
59 return
executed 1068 times by 1 test: return item;
Executed by:
  • libssl.so.1.1
item;
executed 1068 times by 1 test: return item;
Executed by:
  • libssl.so.1.1
1068
60 }-
61-
62 for (curr = -
63 ((void *)0)-
64 , next = pq->items;-
65 next !=
next != ((void *)0)Description
TRUEevaluated 2020 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1182 times by 1 test
Evaluated by:
  • libssl.so.1.1
1182-2020
66 ((void *)0)
next != ((void *)0)Description
TRUEevaluated 2020 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1182 times by 1 test
Evaluated by:
  • libssl.so.1.1
1182-2020
67 ; curr = next, next = next->next) {-
68-
69-
70-
71 int cmp = memcmp(next->priority, item->priority, 8);-
72 if (cmp > 0
cmp > 0Description
TRUEnever evaluated
FALSEevaluated 2020 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
0-2020
73 item->next = next;-
74-
75 if (curr ==
curr == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
76 ((void *)0)
curr == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
77 )-
78 pq->items = item;
never executed: pq->items = item;
0
79 else-
80 curr->next = item;
never executed: curr->next = item;
0
81-
82 return
never executed: return item;
item;
never executed: return item;
0
83 }-
84-
85 else if (cmp == 0
cmp == 0Description
TRUEnever evaluated
FALSEevaluated 2020 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
0-2020
86 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
87 ((void *)0)
never executed: return ((void *)0) ;
0
88 ;
never executed: return ((void *)0) ;
0
89 }
executed 2020 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
2020
90-
91 item->next = -
92 ((void *)0)-
93 ;-
94 curr->next = item;-
95-
96 return
executed 1182 times by 1 test: return item;
Executed by:
  • libssl.so.1.1
item;
executed 1182 times by 1 test: return item;
Executed by:
  • libssl.so.1.1
1182
97}-
98-
99pitem *pqueue_peek(pqueue *pq)-
100{-
101 return
executed 9007 times by 1 test: return pq->items;
Executed by:
  • libssl.so.1.1
pq->items;
executed 9007 times by 1 test: return pq->items;
Executed by:
  • libssl.so.1.1
9007
102}-
103-
104pitem *pqueue_pop(pqueue *pq)-
105{-
106 pitem *item = pq->items;-
107-
108 if (pq->items !=
pq->items != ((void *)0)Description
TRUEevaluated 2250 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 17772 times by 1 test
Evaluated by:
  • libssl.so.1.1
2250-17772
109 ((void *)0)
pq->items != ((void *)0)Description
TRUEevaluated 2250 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 17772 times by 1 test
Evaluated by:
  • libssl.so.1.1
2250-17772
110 )-
111 pq->items = pq->items->next;
executed 2250 times by 1 test: pq->items = pq->items->next;
Executed by:
  • libssl.so.1.1
2250
112-
113 return
executed 20022 times by 1 test: return item;
Executed by:
  • libssl.so.1.1
item;
executed 20022 times by 1 test: return item;
Executed by:
  • libssl.so.1.1
20022
114}-
115-
116pitem *pqueue_find(pqueue *pq, unsigned char *prio64be)-
117{-
118 pitem *next;-
119 pitem *found = -
120 ((void *)0)-
121 ;-
122-
123 if (pq->items ==
pq->items == ((void *)0)Description
TRUEevaluated 417 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1122 times by 1 test
Evaluated by:
  • libssl.so.1.1
417-1122
124 ((void *)0)
pq->items == ((void *)0)Description
TRUEevaluated 417 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1122 times by 1 test
Evaluated by:
  • libssl.so.1.1
417-1122
125 )-
126 return
executed 417 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
executed 417 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
417
127 ((void *)0)
executed 417 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
417
128 ;
executed 417 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
417
129-
130 for (next = pq->items; next->next !=
next->next != ((void *)0)Description
TRUEevaluated 277 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1029 times by 1 test
Evaluated by:
  • libssl.so.1.1
277-1029
131 ((void *)0)
next->next != ((void *)0)Description
TRUEevaluated 277 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1029 times by 1 test
Evaluated by:
  • libssl.so.1.1
277-1029
132 ; next = next->next) {-
133 if (memcmp(next->priority, prio64be, 8) == 0
memcmp(next->p...o64be, 8) == 0Description
TRUEevaluated 93 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 184 times by 1 test
Evaluated by:
  • libssl.so.1.1
) {
93-184
134 found = next;-
135 break;
executed 93 times by 1 test: break;
Executed by:
  • libssl.so.1.1
93
136 }-
137 }
executed 184 times by 1 test: end of block
Executed by:
  • libssl.so.1.1
184
138-
139-
140 if (memcmp(next->priority, prio64be, 8) == 0
memcmp(next->p...o64be, 8) == 0Description
TRUEevaluated 1078 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 44 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
44-1078
141 found = next;
executed 1078 times by 1 test: found = next;
Executed by:
  • libssl.so.1.1
1078
142-
143 if (!found
!foundDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 1078 times by 1 test
Evaluated by:
  • libssl.so.1.1
)
44-1078
144 return
executed 44 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
executed 44 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
44
145 ((void *)0)
executed 44 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
44
146 ;
executed 44 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
44
147-
148 return
executed 1078 times by 1 test: return found;
Executed by:
  • libssl.so.1.1
found;
executed 1078 times by 1 test: return found;
Executed by:
  • libssl.so.1.1
1078
149}-
150-
151pitem *pqueue_iterator(pqueue *pq)-
152{-
153 return
executed 51 times by 1 test: return pqueue_peek(pq);
Executed by:
  • libssl.so.1.1
pqueue_peek(pq);
executed 51 times by 1 test: return pqueue_peek(pq);
Executed by:
  • libssl.so.1.1
51
154}-
155-
156pitem *pqueue_next(piterator *item)-
157{-
158 pitem *ret;-
159-
160 if (item ==
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
161 ((void *)0)
item == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 173 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-173
162 || *
*item == ((void *)0)Description
TRUEevaluated 51 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
item ==
*item == ((void *)0)Description
TRUEevaluated 51 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
51-122
163 ((void *)0)
*item == ((void *)0)Description
TRUEevaluated 51 times by 1 test
Evaluated by:
  • libssl.so.1.1
FALSEevaluated 122 times by 1 test
Evaluated by:
  • libssl.so.1.1
51-122
164 )-
165 return
executed 51 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
executed 51 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
51
166 ((void *)0)
executed 51 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
51
167 ;
executed 51 times by 1 test: return ((void *)0) ;
Executed by:
  • libssl.so.1.1
51
168-
169-
170 ret = *item;-
171 *item = (*item)->next;-
172-
173 return
executed 122 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
ret;
executed 122 times by 1 test: return ret;
Executed by:
  • libssl.so.1.1
122
174}-
175-
176size_t pqueue_size(pqueue *pq)-
177{-
178 pitem *item = pq->items;-
179 size_t count = 0;-
180-
181 while (item !=
item != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-16
182 ((void *)0)
item != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16 times by 1 test
Evaluated by:
  • libssl.so.1.1
0-16
183 ) {-
184 count++;-
185 item = item->next;-
186 }
never executed: end of block
0
187 return
executed 16 times by 1 test: return count;
Executed by:
  • libssl.so.1.1
count;
executed 16 times by 1 test: return count;
Executed by:
  • libssl.so.1.1
16
188}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2