static int index_name_cmp(const void *n1, const void *n2) { int res = qsort_strcasecmp_hlpr(friends[*(int *) n1].name, friends[*(int *) n2].name); /* Use weight to make qsort always put online friends before offline */ res = friends[*(int *) n1].online ? (res - S_WEIGHT) : (res + S_WEIGHT); res = friends[*(int *) n2].online ? (res + S_WEIGHT) : (res - S_WEIGHT); return res; }
static int index_name_cmp_block(const void *n1, const void *n2) { return qsort_strcasecmp_hlpr(Blocked.list[*(int *) n1].name, Blocked.list[*(int *) n2].name); }