Slightly simplify creating an ident from a string on an obstack.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sat, 15 Nov 2008 13:20:05 +0000 (13:20 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sat, 15 Nov 2008 13:20:05 +0000 (13:20 +0000)
[r23681]

mangle.c

index e83bcb3..50075ce 100644 (file)
--- a/mangle.c
+++ b/mangle.c
@@ -253,12 +253,10 @@ ident *create_name_linux_elf(entity_t *entity)
 
        if (needs_mangling) {
                mangle_entity(entity);
-               obstack_1grow(&obst, '\0');
-               char *str = obstack_finish(&obst);
-
-               ident *id = new_id_from_str(str);
+               size_t  size = obstack_object_size(&obst);
+               char   *str  = obstack_finish(&obst);
+               ident  *id   = new_id_from_chars(str, size);
                obstack_free(&obst, str);
-
                return id;
        }