sort: Use a comparer instead of returner

This resolves the FIXME of sorting ranges according to first_ip in IPv6 mode.
This commit is contained in:
Cheer Xiao 2013-01-05 23:08:03 +08:00
parent 4051a953bd
commit 137c1d37c2
2 changed files with 75 additions and 44 deletions

View file

@ -223,12 +223,8 @@ int leasecomp(const void *restrict a, const void *restrict b);
int rangecomp(const void *__restrict r1, const void *__restrict r2)
__attribute__ ((nonnull(1, 2)));
/* sort function pointer and functions */
unsigned long int (*returner) (struct range_t r);
unsigned long int ret_ip(struct range_t r);
unsigned long int ret_cur(struct range_t r);
unsigned long int ret_max(struct range_t r);
int (*comparer) (struct range_t *r1, struct range_t *r2);
unsigned long int ret_percent(struct range_t r);
unsigned long int ret_touched(struct range_t r);
unsigned long int ret_tc(struct range_t r);
unsigned long int ret_tcperc(struct range_t r);
void field_selector(char c);