Do not allocate macro_scope on the heap

I noticed that there's no particular reason to allocate the
macro_scope objects on the heap.  They can be passed around by value
just as easily.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2025-05-29 17:23:04 -06:00
parent 408984ea7b
commit 4aac43f399
6 changed files with 56 additions and 59 deletions

View File

@@ -185,18 +185,18 @@ static void
write_macro_definitions (const struct block *block, CORE_ADDR pc,
struct ui_file *file)
{
gdb::unique_xmalloc_ptr<struct macro_scope> scope;
macro_scope scope;
if (block != NULL)
scope = sal_macro_scope (find_pc_line (pc, 0));
else
scope = default_macro_scope ();
if (scope == NULL)
if (!scope.is_valid ())
scope = user_macro_scope ();
if (scope != NULL && scope->file != NULL && scope->file->table != NULL)
if (scope.is_valid () && scope.file->table != nullptr)
{
macro_for_each_in_scope (scope->file, scope->line,
macro_for_each_in_scope (scope.file, scope.line,
[&] (const char *name,
const macro_definition *macro,
macro_source_file *source,