Minor simplification in abbrev_table::read
authorTom Tromey <tom@tromey.com>
Sat, 8 Feb 2020 20:40:54 +0000 (13:40 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 8 Feb 2020 20:43:24 +0000 (13:43 -0700)
abbrev_table::read increments cur_abbrev->num_attrs in the inner loop,
but there's no need to do this, as the information is already stored
in the temporary vector.

2020-02-08  Tom Tromey  <tom@tromey.com>

* dwarf2/abbrev.c (abbrev_table::read): Simplify.

Change-Id: I765f12850ffa1c6066e884bb22c94468d1abdba4

gdb/ChangeLog
gdb/dwarf2/abbrev.c

index ab208775b6cdc615040858337a9bd0cf7f7fc07a..2dc3a7c8dc917f01eb02762cff47c952ae32dd1b 100644 (file)
@@ -1,3 +1,7 @@
+2020-02-08  Tom Tromey  <tom@tromey.com>
+
+       * dwarf2/abbrev.c (abbrev_table::read): Simplify.
+
 2020-02-08  Tom Tromey  <tom@tromey.com>
 
        * dwarf2/abbrev.c (abbrev_table): Move constructor from header.
index f843e32d950b0b279341cee7ee73a0b3163c4338..59ff138b33d4d71fa8146e1fcc228eb99cb2418c 100644 (file)
@@ -162,9 +162,9 @@ abbrev_table::read (struct objfile *objfile,
          cur_attr.name = (enum dwarf_attribute) abbrev_name;
          cur_attr.form = (enum dwarf_form) abbrev_form;
          cur_attr.implicit_const = implicit_const;
-         ++cur_abbrev->num_attrs;
        }
 
+      cur_abbrev->num_attrs = cur_attrs.size ();
       cur_abbrev->attrs =
        XOBNEWVEC (&abbrev_table->m_abbrev_obstack, struct attr_abbrev,
                   cur_abbrev->num_attrs);