make symtab::dirname const

This makes symtab::dirname const and updates one spot to avoid an
intermediate constless result.

2013-12-06  Tom Tromey  <tromey@redhat.com>

	* buildsym.c (end_symtab_from_static_block): Use obstack_copy0.
	* symtab.h (struct symtab) <dirname>: Now const.
This commit is contained in:
Tom Tromey 2013-11-25 07:40:05 -07:00
parent 21ea9eece7
commit 8e96694e31
3 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2013-12-06 Tom Tromey <tromey@redhat.com>
* buildsym.c (end_symtab_from_static_block): Use obstack_copy0.
* symtab.h (struct symtab) <dirname>: Now const.
2013-12-06 Tom Tromey <tromey@redhat.com>
* symfile.c (allocate_symtab): Remove cast.

View File

@ -1204,10 +1204,10 @@ end_symtab_from_static_block (struct block *static_block,
if (subfile->dirname)
{
/* Reallocate the dirname on the symbol obstack. */
symtab->dirname = (char *)
obstack_alloc (&objfile->objfile_obstack,
strlen (subfile->dirname) + 1);
strcpy (symtab->dirname, subfile->dirname);
symtab->dirname =
obstack_copy0 (&objfile->objfile_obstack,
subfile->dirname,
strlen (subfile->dirname));
}
else
{

View File

@ -879,7 +879,7 @@ struct symtab
/* Directory in which it was compiled, or NULL if we don't know. */
char *dirname;
const char *dirname;
/* Total number of lines found in source file. */