-#else
-
-/* Choose least point in queue */
-static ArtPriPoint *
-art_pri_choose (ArtPriQ *pq)
-{
- int i;
- int best = 0;
- double best_x, best_y;
- double y;
- ArtPriPoint *result;
-
- if (pq->n_items == 0)
- return NULL;
-
- best_x = pq->items[best]->x;
- best_y = pq->items[best]->y;
-
- for (i = 1; i < pq->n_items; i++)
- {
- y = pq->items[i]->y;
- if (y < best_y || (y == best_y && pq->items[i]->x < best_x))
- {
- best = i;
- best_x = pq->items[best]->x;
- best_y = y;
- }
- }
- result = pq->items[best];
- pq->items[best] = pq->items[--pq->n_items];
- return result;
-}
-
-static void
-art_pri_insert (ArtPriQ *pq, ArtPriPoint *point)
-{
- if (pq->n_items == pq->n_items_max)
- art_expand (pq->items, ArtPriPoint *, pq->n_items_max);
-
- pq->items[pq->n_items++] = point;
-}
-
-#endif
-
-#ifdef TEST_PRIQ
-
-#include <stdlib.h> /* for rand() */
-#include <stdio.h>
-
-static double
-double_rand (double lo, double hi, int quant)
-{
- int tmp = rand () / (RAND_MAX * (1.0 / quant)) + 0.5;
- return lo + tmp * ((hi - lo) / quant);
-}
-
-/*
- * This custom allocator for priority queue points is here so I can
- * test speed. It doesn't look like it will be that significant, but
- * if I want a small improvement later, it's something.
- */
-
-typedef ArtPriPoint *ArtPriPtPool;
-
-static ArtPriPtPool *
-art_pri_pt_pool_new (void)
-{
- ArtPriPtPool *result = art_new (ArtPriPtPool, 1);
- *result = NULL;
- return result;
-}
-
-static ArtPriPoint *
-art_pri_pt_alloc (ArtPriPtPool *pool)
-{
- ArtPriPoint *result = *pool;
- if (result == NULL)
- return art_new (ArtPriPoint, 1);
- else
- {
- *pool = result->user_data;
- return result;
- }
-}
-
-static void
-art_pri_pt_free (ArtPriPtPool *pool, ArtPriPoint *pt)
-{
- pt->user_data = *pool;
- *pool = pt;
-}