diff options
author | Daniel Jacobowitz <drow@false.org> | 2004-02-09 22:19:26 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2004-02-09 22:19:26 +0000 |
commit | ec5cdd75590dff3991b5635db3c507f99b6e62ae (patch) | |
tree | 4fe247f2e12f676ad4749240cc730b4014c50d19 /gdb/cp-namespace.c | |
parent | 43b54b88e73a74b1505df5eb4de6d6885bd4c3b4 (diff) | |
download | gdb-ec5cdd75590dff3991b5635db3c507f99b6e62ae.zip gdb-ec5cdd75590dff3991b5635db3c507f99b6e62ae.tar.gz gdb-ec5cdd75590dff3991b5635db3c507f99b6e62ae.tar.bz2 |
* cp-namespace.c (check_one_possible_namespace_symbol): Don't use
obstack_free.
Diffstat (limited to 'gdb/cp-namespace.c')
-rw-r--r-- | gdb/cp-namespace.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 65d3ecc..a731352 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -783,14 +783,20 @@ check_one_possible_namespace_symbol (const char *name, int len, struct objfile *objfile) { struct block *block = get_possible_namespace_block (objfile); - char *name_copy = obsavestring (name, len, &objfile->objfile_obstack); - struct symbol *sym = lookup_block_symbol (block, name_copy, NULL, - VAR_DOMAIN); + char *name_copy = alloca (len + 1); + struct symbol *sym; + + memcpy (name_copy, name, len); + name_copy[len] = '\0'; + sym = lookup_block_symbol (block, name_copy, NULL, VAR_DOMAIN); if (sym == NULL) { - struct type *type = init_type (TYPE_CODE_NAMESPACE, 0, 0, - name_copy, objfile); + struct type *type; + name_copy = obsavestring (name, len, &objfile->objfile_obstack); + + type = init_type (TYPE_CODE_NAMESPACE, 0, 0, name_copy, objfile); + TYPE_TAG_NAME (type) = TYPE_NAME (type); sym = obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); @@ -806,11 +812,7 @@ check_one_possible_namespace_symbol (const char *name, int len, return 0; } else - { - obstack_free (&objfile->objfile_obstack, name_copy); - - return 1; - } + return 1; } /* Look for a symbol named NAME in all the possible namespace blocks. |