Hi, Simplify pqueue_find() to the very essential bits. This change should exhibit no functional changes or side-effects.
Tested against the regression tests for pqueue. ok? =================================================================== --- pqueue.orig/pqueue.c +++ pqueue/pqueue.c @@ -158,22 +158,11 @@ pitem * pqueue_find(pqueue_s *pq, unsigned char *prio64be) { pitem *next; - pitem *found = NULL; - if (pq->items == NULL) - return NULL; - - for (next = pq->items; next != NULL; next = next->next) { - if (memcmp(next->priority, prio64be, 8) == 0) { - found = next; - break; - } - } - - if (!found) - return NULL; - - return found; + for (next = pq->items; next != NULL; next = next->next) + if (memcmp(next->priority, prio64be, 8) == 0) + return next; + return NULL; } void