When two type pointers designate two types with the same pretty
printed representatin don't already have an associated type id, the
comparison code was mistakenly associating them with empty type id.
This patch fixes that.
Note that the necessary adjustment to reference outputs of abidw in
the regression test suite is not provided with this patch to ease
backporting. Those adjustments are in a patch that comes at the end
of this patch series.
* src/abg-writer.cc (type_ptr_comp::operator()): Do not add an
empty type id string to the type -> type id map when the entry for
a given type is empty.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
#include <algorithm>
#include <tr1/unordered_map>
+#include "abg-tools-utils.h"
+
#include "abg-internal.h"
// <headers defining libabigail's API go under here>
ABG_BEGIN_EXPORT_DECLARATIONS
if (r1 == r2)
{
- r1 = (*map)[const_cast<type_base*>(l)];
- r2 = (*map)[const_cast<type_base*>(r)];
+ type_ptr_map::const_iterator i =
+ map->find(const_cast<type_base*>(l));
+ if (i != map->end())
+ r1 = i->second;
+ i = map->find(const_cast<type_base*>(r));
+ if (i != map->end())
+ r2 = i->second;
}
return r1 < r2;