Add priority queue module, for later use in event

Add generic priority queue, based on the version found in CRLS. Supports
O(lg n) inserts and deletes, and O(1) get 'top' (whether this is the min or
max is configurable). Also supports iteration.

Also includes a much needed darray_get_elem function (why didn't I already
have this???).