forked from Imagelibrary/binutils-gdb
Constify linetables
Linetables no longer change after they are created. This patch applies const to them. Note there is one hack to cast away const in mdebugread.c. This code allocates a linetable using 'malloc', then later copies it to the obstack. While this could be cleaned up, I chose not to do so because I have no way of testing it. Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@@ -916,13 +916,15 @@ buildsym_compunit::end_compunit_symtab_with_blockvector
|
||||
size_t entry_array_size = n_entries * sizeof (struct linetable_entry);
|
||||
int linetablesize = sizeof (struct linetable) + entry_array_size;
|
||||
|
||||
symtab->set_linetable
|
||||
(XOBNEWVAR (&m_objfile->objfile_obstack, struct linetable,
|
||||
linetablesize));
|
||||
struct linetable *new_table
|
||||
= XOBNEWVAR (&m_objfile->objfile_obstack, struct linetable,
|
||||
linetablesize);
|
||||
|
||||
symtab->linetable ()->nitems = n_entries;
|
||||
memcpy (symtab->linetable ()->item,
|
||||
new_table->nitems = n_entries;
|
||||
memcpy (new_table->item,
|
||||
subfile->line_vector_entries.data (), entry_array_size);
|
||||
|
||||
symtab->set_linetable (new_table);
|
||||
}
|
||||
else
|
||||
symtab->set_linetable (nullptr);
|
||||
|
||||
Reference in New Issue
Block a user