optimized a tad bit more
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 02 Aug 2010 01:21:51 +0200
changeset 31 b3e68c942712
parent 30 3e61fc61be62
child 32 4132acb8993e
optimized a tad bit more
src/dwarf2-abbrev.c
src/dwarf2-abbrev.h
src/dwarf2-info.c
--- a/src/dwarf2-abbrev.c	Mon Aug 02 01:02:34 2010 +0200
+++ b/src/dwarf2-abbrev.c	Mon Aug 02 01:21:51 2010 +0200
@@ -214,19 +214,7 @@
         assert (false);
 }
 
-void 
-dwarf2_abbrev_attr_read_first (struct dwarf2_abbrev_decl *decl,
-                               struct dwarf2_abbrev_attr *attr,
-                               uint32_t *new_offset,
-                               struct reader *reader)
-{
-        reader_seek (reader, decl->offset);
-        attr->name = reader_read_uleb128 (reader);
-        attr->form = reader_read_uleb128 (reader);
-        *new_offset = reader_get_offset (reader);
-}
-
-void 
+bool
 dwarf2_abbrev_attr_read (uint32_t cur_offset,
                          struct dwarf2_abbrev_attr *attr,
                          uint32_t *new_offset,
@@ -236,6 +224,7 @@
         attr->name = reader_read_uleb128 (reader);
         attr->form = reader_read_uleb128 (reader);
         *new_offset = reader_get_offset (reader);
+        return attr->name != 0;
 }
 
 bool 
--- a/src/dwarf2-abbrev.h	Mon Aug 02 01:02:34 2010 +0200
+++ b/src/dwarf2-abbrev.h	Mon Aug 02 01:21:51 2010 +0200
@@ -73,15 +73,10 @@
                               uint64_t code,
                               struct reader *reader);
 
-void dwarf2_abbrev_attr_read_first (struct dwarf2_abbrev_decl *decl,
-                                    struct dwarf2_abbrev_attr *attr,
-                                    uint32_t *new_offset,
-                                    struct reader *reader);
-void dwarf2_abbrev_attr_read (uint32_t cur_offset,
+bool dwarf2_abbrev_attr_read (uint32_t cur_offset,
                               struct dwarf2_abbrev_attr *attr,
                               uint32_t *new_offset,
                               struct reader *reader);
-bool dwarf2_abbrev_attr_is_last (struct dwarf2_abbrev_attr *attr);
 
 #ifdef __cplusplus
 }
--- a/src/dwarf2-info.c	Mon Aug 02 01:02:34 2010 +0200
+++ b/src/dwarf2-info.c	Mon Aug 02 01:21:51 2010 +0200
@@ -320,10 +320,13 @@
         
         // now, parse together both the attribute description in the abbrev
         // table and the attribute data in the info table.
-        dwarf2_abbrev_attr_read_first (&decl, &attr, &attr_offset, reader2);
-        while (!dwarf2_abbrev_attr_is_last (&attr)) {
+        reader_seek (reader2, decl.offset);
+        attr.name = reader_read_uleb128 (reader2);
+        attr.form = reader_read_uleb128 (reader2);
+        while (attr.name != 0) {
                 attr_read_entry (cuh, &attr, entry, reader1);
-                dwarf2_abbrev_attr_read (attr_offset, &attr, &attr_offset, reader2);
+                attr.name = reader_read_uleb128 (reader2);
+                attr.form = reader_read_uleb128 (reader2);
         }
         *next = reader_get_offset (reader1);
 }