/* Only used for sorting/searchin a songvec, not general purpose compares */ static int song_cmp(G_GNUC_UNUSED void *priv, struct list_head *_a, struct list_head *_b) { const struct song *a = (const struct song *)_a; const struct song *b = (const struct song *)_b; int ret; /* first sort by album */ ret = compare_string_tag_item(a->tag, b->tag, TAG_ALBUM); if (ret != 0) return ret; /* then sort by disc */ ret = compare_tag_item(a->tag, b->tag, TAG_DISC); if (ret != 0) return ret; /* then by track number */ ret = compare_tag_item(a->tag, b->tag, TAG_TRACK); if (ret != 0) return ret; /* still no difference? compare file name */ return g_utf8_collate(a->uri, b->uri); }
/* Only used for sorting/searchin a songvec, not general purpose compares */ static int songvec_cmp(const void *s1, const void *s2) { const struct song *a = ((const struct song * const *)s1)[0]; const struct song *b = ((const struct song * const *)s2)[0]; int ret; /* first sort by disc */ ret = compare_tag_item(a->tag, b->tag, TAG_ITEM_DISC); if (ret != 0) return ret; /* then by track number */ ret = compare_tag_item(a->tag, b->tag, TAG_ITEM_TRACK); if (ret != 0) return ret; /* still no difference? compare file name */ return g_utf8_collate(a->url, b->url); }