PR: 2730
[oweals/openssl.git] / crypto / pqueue / pqueue.c
index c20bc6fc965c51ac4af8a1f6efa3c1bec8d2704a..eab13a125013bffc7b7e08d0cafb3a182b8728f5 100644 (file)
@@ -167,14 +167,13 @@ pqueue_pop(pqueue_s *pq)
 pitem *
 pqueue_find(pqueue_s *pq, unsigned char *prio64be)
        {
-       pitem *next, *prev = NULL;
+       pitem *next;
        pitem *found = NULL;
 
        if ( pq->items == NULL)
                return NULL;
 
-       for ( next = pq->items; next->next != NULL; 
-                 prev = next, next = next->next)
+       for ( next = pq->items; next->next != NULL; next = next->next)
                {
                if ( memcmp(next->priority, prio64be,8) == 0)
                        {
@@ -237,3 +236,17 @@ pqueue_next(pitem **item)
 
        return ret;
        }
+
+int
+pqueue_size(pqueue_s *pq)
+{
+       pitem *item = pq->items;
+       int count = 0;
+       
+       while(item != NULL)
+       {
+               count++;
+               item = item->next;
+       }
+       return count;
+}