From: Dodji Seketeli Date: Wed, 19 Apr 2023 14:24:05 +0000 (+0200) Subject: comparison: Fix index error when interpreting scope comparison X-Git-Tag: upstream/2.3~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2078e2784900a4a9256364a752d653f9aa6e807c;p=platform%2Fupstream%2Flibabigail.git comparison: Fix index error when interpreting scope comparison While looking at something else, I noticed a thinko in the code in scope_diff::ensure_lookup_tables_populated that interprets the result of the diffing algorithm on the decls of a given scope. Fixed thus. * src/abg-comparison.cc (scope_diff::ensure_lookup_tables_populated): Use the proper index to address the deleted decl. Also, use the range-based for syntax in the enclosing for-loop for more clarity. Signed-off-by: Dodji Seketeli --- diff --git a/src/abg-comparison.cc b/src/abg-comparison.cc index 59530a8a..9c580da2 100644 --- a/src/abg-comparison.cc +++ b/src/abg-comparison.cc @@ -6522,10 +6522,9 @@ scope_diff::ensure_lookup_tables_populated() edit_script& e = priv_->member_changes_; // Populate deleted types & decls lookup tables. - for (vector::const_iterator i = e.deletions().begin(); - i != e.deletions().end(); - ++i) + for (const auto& deletion : e.deletions()) { + unsigned i = deletion.index(); decl_base_sptr decl = deleted_member_at(i); string qname = decl->get_qualified_name(); if (is_type(decl))