]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Simplify get_frame_unwind_table
authorTom Tromey <tromey@adacore.com>
Fri, 17 Jan 2025 19:01:38 +0000 (12:01 -0700)
committerTom Tromey <tromey@adacore.com>
Fri, 17 Jan 2025 19:59:31 +0000 (12:59 -0700)
This simplifies get_frame_unwind_table, changing it to use the
registry 'emplace' method and to pass the initialization iterators to
the constructor.  This fixes a build problem on x86 -- reported by the
auto-builder -- as a side effect.

Tested-By: Guinevere Larsen <guinevere@redhat.com>
gdb/frame-unwind.c

index fab9b3c981abc3f5ed6d8e91759cedebee93197d..33b23f91febc4b183bf3fa2acc42ec8c7732e837 100644 (file)
@@ -73,15 +73,10 @@ static std::vector<const frame_unwind *> &
 get_frame_unwind_table (struct gdbarch *gdbarch)
 {
   std::vector<const frame_unwind *> *table = frame_unwind_data.get (gdbarch);
-  if (table != nullptr)
-    return *table;
-
-  table = new std::vector<const frame_unwind *>;
-  table->insert (table->begin (), standard_unwinders.begin (),
-                standard_unwinders.end ());
-
-  frame_unwind_data.set (gdbarch, table);
-
+  if (table == nullptr)
+    table = frame_unwind_data.emplace (gdbarch,
+                                      standard_unwinders.begin (),
+                                      standard_unwinders.end ());
   return *table;
 }