diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 33366e2d81..9cec9c33b2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-12-06 Tom Tromey + + * buildsym.c (end_symtab_from_static_block): Use obstack_copy0. + * symtab.h (struct symtab) : Now const. + 2013-12-06 Tom Tromey * symfile.c (allocate_symtab): Remove cast. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 0326e264ab..8d9bdb1496 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -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 { diff --git a/gdb/symtab.h b/gdb/symtab.h index 821479ac7b..3be85cae73 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -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. */