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