const struct ref * get_canonical_ref(const char *id) { const struct ref *ref = NULL; const struct ref *pos; foreach_ref_list(pos, id) if (!ref || ref_canonical_compare(pos, ref) < 0) ref = pos; return ref; }
struct ref * get_canonical_ref(const char *id) { struct ref_list *list = get_ref_list(id); struct ref *ref = NULL; size_t i; for (i = 0; list && i < list->size; i++) if (!ref || ref_canonical_compare(list->refs[i], ref) < 0) ref = list->refs[i]; return ref; }