]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Initialize whole abbrev/abbrev_attrib instead of just the where
authorPetr Machata <pmachata@redhat.com>
Wed, 13 Apr 2011 08:56:01 +0000 (10:56 +0200)
committerPetr Machata <pmachata@redhat.com>
Wed, 13 Apr 2011 08:56:01 +0000 (10:56 +0200)
dwarflint/check_debug_abbrev.cc
dwarflint/check_debug_abbrev.hh

index 771c506d5488e7117927661532fd47f632542918..f7ae7d2ae1cdae09ec37a774aba136fa81c14cd1 100644 (file)
@@ -303,18 +303,17 @@ namespace
            << "duplicate abbrev code " << abbr_code
            << "; already defined at " << original->where << '.' << std::endl;
 
-       struct abbrev fake;
-       struct abbrev *cur;
+       abbrev fake;
+       abbrev *cur;
        /* Don't actually save this abbrev if it's duplicate.  */
        if (likely (original == NULL))
          {
            REALLOC (section, abbr);
            cur = section->abbr + section->size++;
+           new (cur) abbrev ();
          }
        else
          cur = &fake;
-       WIPE (*cur);
-       new (&cur->where) class where ();
 
        cur->code = abbr_code;
        cur->where = where;
@@ -383,8 +382,7 @@ namespace
            REALLOC (cur, attribs);
 
            struct abbrev_attrib *acur = cur->attribs + cur->size++;
-           WIPE (*acur);
-           new (&acur->where) class where ();
+           new (acur) abbrev_attrib ();
            acur->name = attrib_name;
            acur->form = attrib_form;
            acur->where = where;
index 7fc1aefdf454bde03594ffb527f28a7b91eab1d7..c1cbc9359dd2fff7cb9b42005c7444a88f0f8382 100644 (file)
@@ -1,5 +1,5 @@
 /* Low-level checking of .debug_abbrev.
-   Copyright (C) 2009, 2010 Red Hat, Inc.
+   Copyright (C) 2009, 2010, 2011 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
 
 struct abbrev_attrib
 {
-  struct where where;
+  ::where where;
   uint16_t name;
   uint8_t form;
+
+  abbrev_attrib ()
+    : where ()
+    , name (0)
+    , form (0)
+  {}
 };
 
 struct abbrev
 {
+  ::where where;
   uint64_t code;
-  struct where where;
 
   /* Attributes.  */
-  struct abbrev_attrib *attribs;
+  abbrev_attrib *attribs;
   size_t size;
   size_t alloc;
 
@@ -56,6 +62,17 @@ struct abbrev
 
   /* Whether some DIE uses this abbrev.  */
   bool used;
+
+  abbrev ()
+    : where ()
+    , code (0)
+    , attribs (0)
+    , size (0)
+    , alloc (0)
+    , tag (0)
+    , has_children (false)
+    , used (false)
+  {}
 };
 
 struct abbrev_table