| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/ssl/pqueue.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | typedef struct _pqueue { | - | ||||||||||||
| 4 | pitem *items; | - | ||||||||||||
| 5 | int count; | - | ||||||||||||
| 6 | } pqueue_s; | - | ||||||||||||
| 7 | - | |||||||||||||
| 8 | pitem * | - | ||||||||||||
| 9 | pitem_new(unsigned char *prio64be, void *data) | - | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | pitem *item = malloc(sizeof(pitem)); | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | if (item ==
| 0-132 | ||||||||||||
| 14 | ((void *)0)
| 0-132 | ||||||||||||
| 15 | ) | - | ||||||||||||
| 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 | memcpy(item->priority, prio64be, sizeof(item->priority)); | - | ||||||||||||
| 21 | - | |||||||||||||
| 22 | item->data = data; | - | ||||||||||||
| 23 | item->next = | - | ||||||||||||
| 24 | ((void *)0) | - | ||||||||||||
| 25 | ; | - | ||||||||||||
| 26 | - | |||||||||||||
| 27 | return executed 132 times by 3 tests: item;return item;Executed by:
executed 132 times by 3 tests: return item;Executed by:
| 132 | ||||||||||||
| 28 | } | - | ||||||||||||
| 29 | - | |||||||||||||
| 30 | void | - | ||||||||||||
| 31 | pitem_free(pitem *item) | - | ||||||||||||
| 32 | { | - | ||||||||||||
| 33 | free(item); | - | ||||||||||||
| 34 | } executed 132 times by 3 tests: end of blockExecuted by:
| 132 | ||||||||||||
| 35 | - | |||||||||||||
| 36 | pqueue_s * | - | ||||||||||||
| 37 | pqueue_new(void) | - | ||||||||||||
| 38 | { | - | ||||||||||||
| 39 | return executed 166 times by 6 tests: calloc(1, sizeof(pqueue_s));return calloc(1, sizeof(pqueue_s));Executed by:
executed 166 times by 6 tests: return calloc(1, sizeof(pqueue_s));Executed by:
| 166 | ||||||||||||
| 40 | } | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | void | - | ||||||||||||
| 43 | pqueue_free(pqueue_s *pq) | - | ||||||||||||
| 44 | { | - | ||||||||||||
| 45 | free(pq); | - | ||||||||||||
| 46 | } executed 161 times by 6 tests: end of blockExecuted by:
| 161 | ||||||||||||
| 47 | - | |||||||||||||
| 48 | pitem * | - | ||||||||||||
| 49 | pqueue_insert(pqueue_s *pq, pitem *item) | - | ||||||||||||
| 50 | { | - | ||||||||||||
| 51 | pitem *curr, *next; | - | ||||||||||||
| 52 | - | |||||||||||||
| 53 | if (pq->items ==
| 54-78 | ||||||||||||
| 54 | ((void *)0)
| 54-78 | ||||||||||||
| 55 | ) { | - | ||||||||||||
| 56 | pq->items = item; | - | ||||||||||||
| 57 | return executed 54 times by 3 tests: item;return item;Executed by:
executed 54 times by 3 tests: return item;Executed by:
| 54 | ||||||||||||
| 58 | } | - | ||||||||||||
| 59 | - | |||||||||||||
| 60 | for (curr = | - | ||||||||||||
| 61 | ((void *)0) | - | ||||||||||||
| 62 | , next = pq->items; next !=
| 77-135 | ||||||||||||
| 63 | ((void *)0)
| 77-135 | ||||||||||||
| 64 | ; | - | ||||||||||||
| 65 | curr = next, next = next->next) { | - | ||||||||||||
| 66 | - | |||||||||||||
| 67 | - | |||||||||||||
| 68 | int cmp = memcmp(next->priority, item->priority, | - | ||||||||||||
| 69 | sizeof(item->priority)); | - | ||||||||||||
| 70 | if (cmp > 0
| 1-134 | ||||||||||||
| 71 | item->next = next; | - | ||||||||||||
| 72 | - | |||||||||||||
| 73 | if (curr ==
| 0-1 | ||||||||||||
| 74 | ((void *)0)
| 0-1 | ||||||||||||
| 75 | ) | - | ||||||||||||
| 76 | pq->items = item; executed 1 time by 1 test: pq->items = item;Executed by:
| 1 | ||||||||||||
| 77 | else | - | ||||||||||||
| 78 | curr->next = item; never executed: curr->next = item; | 0 | ||||||||||||
| 79 | - | |||||||||||||
| 80 | return executed 1 time by 1 test: item;return item;Executed by:
executed 1 time by 1 test: return item;Executed by:
| 1 | ||||||||||||
| 81 | } else if (cmp == 0
| 0-134 | ||||||||||||
| 82 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||
| 83 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||
| 84 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||
| 85 | } executed 134 times by 2 tests: end of blockExecuted by:
| 134 | ||||||||||||
| 86 | - | |||||||||||||
| 87 | item->next = | - | ||||||||||||
| 88 | ((void *)0) | - | ||||||||||||
| 89 | ; | - | ||||||||||||
| 90 | curr->next = item; | - | ||||||||||||
| 91 | - | |||||||||||||
| 92 | return executed 77 times by 2 tests: item;return item;Executed by:
executed 77 times by 2 tests: return item;Executed by:
| 77 | ||||||||||||
| 93 | } | - | ||||||||||||
| 94 | - | |||||||||||||
| 95 | pitem * | - | ||||||||||||
| 96 | pqueue_peek(pqueue_s *pq) | - | ||||||||||||
| 97 | { | - | ||||||||||||
| 98 | return executed 350 times by 3 tests: pq->items;return pq->items;Executed by:
executed 350 times by 3 tests: return pq->items;Executed by:
| 350 | ||||||||||||
| 99 | } | - | ||||||||||||
| 100 | - | |||||||||||||
| 101 | pitem * | - | ||||||||||||
| 102 | pqueue_pop(pqueue_s *pq) | - | ||||||||||||
| 103 | { | - | ||||||||||||
| 104 | pitem *item = pq->items; | - | ||||||||||||
| 105 | - | |||||||||||||
| 106 | if (pq->items !=
| 132-892 | ||||||||||||
| 107 | ((void *)0)
| 132-892 | ||||||||||||
| 108 | ) | - | ||||||||||||
| 109 | pq->items = pq->items->next; executed 132 times by 3 tests: pq->items = pq->items->next;Executed by:
| 132 | ||||||||||||
| 110 | - | |||||||||||||
| 111 | return executed 1024 times by 6 tests: item;return item;Executed by:
executed 1024 times by 6 tests: return item;Executed by:
| 1024 | ||||||||||||
| 112 | } | - | ||||||||||||
| 113 | - | |||||||||||||
| 114 | pitem * | - | ||||||||||||
| 115 | pqueue_find(pqueue_s *pq, unsigned char *prio64be) | - | ||||||||||||
| 116 | { | - | ||||||||||||
| 117 | pitem *next; | - | ||||||||||||
| 118 | - | |||||||||||||
| 119 | for (next = pq->items; next !=
| 8-17 | ||||||||||||
| 120 | ((void *)0)
| 8-17 | ||||||||||||
| 121 | ; next = next->next) | - | ||||||||||||
| 122 | if (memcmp(next->priority, prio64be,
| 3-14 | ||||||||||||
| 123 | sizeof(next->priority)) == 0
| 3-14 | ||||||||||||
| 124 | return executed 14 times by 2 tests: next;return next;Executed by:
executed 14 times by 2 tests: return next;Executed by:
| 14 | ||||||||||||
| 125 | - | |||||||||||||
| 126 | return executed 8 times by 1 test: return ((void *)0) ;Executed by:
executed 8 times by 1 test: return ((void *)0) ;Executed by:
| 8 | ||||||||||||
| 127 | ((void *)0) executed 8 times by 1 test: return ((void *)0) ;Executed by:
| 8 | ||||||||||||
| 128 | ; executed 8 times by 1 test: return ((void *)0) ;Executed by:
| 8 | ||||||||||||
| 129 | } | - | ||||||||||||
| 130 | - | |||||||||||||
| 131 | pitem * | - | ||||||||||||
| 132 | pqueue_iterator(pqueue_s *pq) | - | ||||||||||||
| 133 | { | - | ||||||||||||
| 134 | return executed 1 time by 1 test: pqueue_peek(pq);return pqueue_peek(pq);Executed by:
executed 1 time by 1 test: return pqueue_peek(pq);Executed by:
| 1 | ||||||||||||
| 135 | } | - | ||||||||||||
| 136 | - | |||||||||||||
| 137 | pitem * | - | ||||||||||||
| 138 | pqueue_next(pitem **item) | - | ||||||||||||
| 139 | { | - | ||||||||||||
| 140 | pitem *ret; | - | ||||||||||||
| 141 | - | |||||||||||||
| 142 | if (item ==
| 0-4 | ||||||||||||
| 143 | ((void *)0)
| 0-4 | ||||||||||||
| 144 | || *
| 1-3 | ||||||||||||
| 145 | ((void *)0)
| 1-3 | ||||||||||||
| 146 | ) | - | ||||||||||||
| 147 | return executed 1 time by 1 test: return ((void *)0) ;Executed by:
executed 1 time by 1 test: return ((void *)0) ;Executed by:
| 1 | ||||||||||||
| 148 | ((void *)0) executed 1 time by 1 test: return ((void *)0) ;Executed by:
| 1 | ||||||||||||
| 149 | ; executed 1 time by 1 test: return ((void *)0) ;Executed by:
| 1 | ||||||||||||
| 150 | - | |||||||||||||
| 151 | - | |||||||||||||
| 152 | ret = *item; | - | ||||||||||||
| 153 | *item = (*item)->next; | - | ||||||||||||
| 154 | - | |||||||||||||
| 155 | return executed 3 times by 1 test: ret;return ret;Executed by:
executed 3 times by 1 test: return ret;Executed by:
| 3 | ||||||||||||
| 156 | } | - | ||||||||||||
| 157 | - | |||||||||||||
| 158 | int | - | ||||||||||||
| 159 | pqueue_size(pqueue_s *pq) | - | ||||||||||||
| 160 | { | - | ||||||||||||
| 161 | pitem *item = pq->items; | - | ||||||||||||
| 162 | int count = 0; | - | ||||||||||||
| 163 | - | |||||||||||||
| 164 | while (item !=
| 0 | ||||||||||||
| 165 | ((void *)0)
| 0 | ||||||||||||
| 166 | ) { | - | ||||||||||||
| 167 | count++; | - | ||||||||||||
| 168 | item = item->next; | - | ||||||||||||
| 169 | } never executed: end of block | 0 | ||||||||||||
| 170 | return never executed: count;return count;never executed: return count; | 0 | ||||||||||||
| 171 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |