1 /* GNU LGPL version 2 (or later) - see LICENSE file for details */
4 #include <ccan/cast/cast.h>
6 #include <ccan/lpq/lpq.h>
8 static int lpq_cmp(const struct lpq_ *pq, size_t offset,
9 const struct lpq_link *al, const struct lpq_link *bl)
11 void *a = (char *)al - offset;
12 void *b = (char *)bl - offset;
14 return total_order_cmp(pq->order, a, b);
17 struct lpq_link **lpq_frontp_(struct lpq_ *pq, size_t offset)
19 struct lpq_link **frontp = &pq->list;
25 for (p = &(pq->list->next); *p; p = &(*p)->next) {
26 if (lpq_cmp(pq, offset, *p, *frontp) >= 0)