summaryrefslogtreecommitdiffstats
path: root/libdw/dwarf_getabbrev.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2017-12-26 16:49:46 +0100
committerMark Wielaard <[email protected]>2018-01-01 22:48:56 +0100
commitc09d611f823c8a6ddb8513fd1113b1ced61baf6c (patch)
tree0a645c3b4eb77d0ccfb51d8cf277e76aee9d42a4 /libdw/dwarf_getabbrev.c
parentbfb2117387eb98eae4f0aace7c32061a27483adc (diff)
libdw: Reduce size of struct Dwarf_Abbrev.
If we don't cache the attrcnt and use bitfields for the has_children and code we can reduce the size of struct Dwarf Abbrev from 32 to 24 bytes on 64bit architectures and from 28 to 20 bytes on 32bit arches. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'libdw/dwarf_getabbrev.c')
-rw-r--r--libdw/dwarf_getabbrev.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c
index ef51b847..a3a68b37 100644
--- a/libdw/dwarf_getabbrev.c
+++ b/libdw/dwarf_getabbrev.c
@@ -1,5 +1,5 @@
/* Get abbreviation at given offset.
- Copyright (C) 2003, 2004, 2005, 2006, 2014 Red Hat, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2014, 2017 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <[email protected]>, 2003.
@@ -121,8 +121,7 @@ __libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu, Dwarf_Off offset,
abb->attrp = (unsigned char *) abbrevp;
abb->offset = offset;
- /* Skip over all the attributes and count them while doing so. */
- abb->attrcnt = 0;
+ /* Skip over all the attributes and check rest of the abbrev is valid. */
unsigned int attrname;
unsigned int attrform;
do
@@ -134,7 +133,7 @@ __libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu, Dwarf_Off offset,
goto invalid;
get_uleb128 (attrform, abbrevp, end);
}
- while (attrname != 0 && attrform != 0 && ++abb->attrcnt);
+ while (attrname != 0 && attrform != 0);
/* Return the length to the caller if she asked for it. */
if (lengthp != NULL)