Remove a VEC from type.c

This removes a VEC from type.c, by using std::vector.

While doing this I also took the opportunity to change
types_deeply_equal to return bool.  This caught some weird code in
typy_richcompare, now fixed.

And, since I was changing types_deeply_equal, it seemed like a good
idea to also change types_equal, so this patch includes that as well.

Tested by the buildbot.

ChangeLog
2018-05-29  Tom Tromey  <tom@tromey.com>

	* python/py-type.c (typy_richcompare): Update.
	* guile/scm-type.c (tyscm_equal_p_type_smob): Update.
	* gdbtypes.h (types_deeply_equal): Return bool.
	(types_equal): Likewise.
	* gdbtypes.c (type_equality_entry_d): Remove typedef.  Don't
	declare VEC.
	(check_types_equal): Change worklist to std::vector.  Return
	bool.
	(struct type_equality_entry): Add constructor.
	(compare_maybe_null_strings): Return bool.
	(check_types_worklist): Return bool.  Change worklist to
	std::vector.
	(types_deeply_equal): Use std::vector.
	(types_equal): Return bool.
	(compare_maybe_null_strings): Simplify.
This commit is contained in:
Tom Tromey 2018-05-29 00:29:23 -06:00
parent 10b2ded43c
commit 894882e344
5 changed files with 87 additions and 80 deletions

View file

@ -1008,7 +1008,7 @@ typy_str (PyObject *self)
static PyObject *
typy_richcompare (PyObject *self, PyObject *other, int op)
{
int result = Py_NE;
bool result = false;
struct type *type1 = type_object_to_type (self);
struct type *type2 = type_object_to_type (other);
@ -1021,7 +1021,7 @@ typy_richcompare (PyObject *self, PyObject *other, int op)
}
if (type1 == type2)
result = Py_EQ;
result = true;
else
{
TRY