C++ify badness_vector, fix leaks
badness_vector is currently an open coded vector. This reimplements
it as a std::vector.
This fixes a few leaks as well:
- find_oload_champ is leaking every badness vector calculated bar the
one returned.
- bv->rank is always leaked, since callers of rank_function only
xfree the badness_vector pointer, not bv->rank.
gdb/ChangeLog:
2018-11-21 Pedro Alves <palves@redhat.com>
* gdbtypes.c (compare_badness): Change type of parameters to const
reference. Adjust to badness_vector being a std::vector now.
(rank_function): Adjust to badness_vector being a std::vector now.
* gdbtypes.h (badness_vector): Now a typedef to std::vector.
(LENGTH_MATCH): Delete.
(compare_badness): Change type of parameters to const reference.
(rank_function): Return a badness_vector by value now.
(find_overload_match): Adjust to badness_vector being a
std::vector now. Remove cleanups.
(find_oload_champ_namespace): 'oload_champ_bv' parameter now a
badness_vector pointer.
(find_oload_champ_namespace_loop): 'oload_champ_bv' parameter now
a badness_vector pointer. Adjust to badness_vector being a
std::vector now. Remove cleanups.
(find_oload_champ): 'oload_champ_bv' parameter now
a badness_vector pointer. Adjust to badness_vector being a
std::vector now. Remove cleanups.