- unsigned best_size = 0;
- for(vector<string>::const_iterator i=names.begin(); i!=names.end(); ++i)
- if(match_name(*i))
- {
- /* TODO Do full parse and alias resolution here? Otherwise x86 and
- x86_64 are treated as equally good, even though the latter is more
- specific. */
- unsigned size = 1;
- for(string::const_iterator j=i->begin(); j!=i->end(); ++j)
- size += (*j=='-');
-
- if(size>best_size)
+ unsigned best_quality = 0;
+ for(const string &n: names)
+ {
+ unsigned quality;
+ if(match_name(n, &quality))
+ if(quality>best_quality)