mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-25 16:57:52 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user