OPENSSL_free(item);
}
-pqueue pqueue_new() {
+pqueue pqueue_new(void) {
pqueue_s *pq = (pqueue_s *)OPENSSL_malloc(sizeof(pqueue_s));
if (pq == NULL) {
return NULL;
pitem *curr;
for (curr = pq->items; curr; curr = curr->next) {
- if (memcmp(curr->priority, prio64be, 8) == 0) {
+ if (memcmp(curr->priority, prio64be, sizeof(curr->priority)) == 0) {
return curr;
}
}
return count;
}
-pitem *pqueue_iterator(pqueue_s *pq) { return pq->items; }
+piterator pqueue_iterator(pqueue_s *pq) { return pq->items; }
-pitem *pqueue_next(pitem **item) {
+pitem *pqueue_next(piterator *item) {
pitem *ret;
if (item == NULL || *item == NULL) {
for (curr = NULL, next = pq->items; next != NULL;
curr = next, next = next->next) {
/* we can compare 64-bit value in big-endian encoding with memcmp. */
- int cmp = memcmp(next->priority, item->priority, 8);
- if (cmp > 0) /* next > item */
- {
+ int cmp = memcmp(next->priority, item->priority, sizeof(item->priority));
+ if (cmp > 0) {
+ /* next > item */
item->next = next;
if (curr == NULL) {
}
return item;
- } else if (cmp == 0) /* duplicates not allowed */
+ } else if (cmp == 0) {
+ /* duplicates not allowed */
return NULL;
+ }
}
item->next = NULL;