entrycmp: split in two to avoid use of qsort_r
entrycmp: split in two to avoid use of qsort_r

qsort_r isn't standard/portable, so work around that by splitting the
comparator up in the only two incarnations we need.

Skyscanner/carbon-c-relay,lyft/carbon-c-relay,zzl0/carbon-c-relay,grobian/carbon-c-relay,piotr1212/carbon-c-relay,rtoma/carbon-c-relay,tjamesturner/carbon-c-relay,piotr1212/carbon-c-relay,lyft/carbon-c-relay,piotr1212/carbon-c-relay,grobian/carbon-c-relay,tjamesturner/carbon-c-relay,Skyscanner/carbon-c-relay,zzl0/carbon-c-relay,piotr1212/carbon-c-relay,rtoma/carbon-c-relay,grobian/carbon-c-relay,lyft/carbon-c-relay