Use XOBNEW/XOBNEWVEC/OBSTACK_ZALLOC when possible
[binutils-gdb.git] / gdb / ada-lang.c
index 1af09bc00ecc42f9c103b5fd6f3b34d22b6b3c0c..f2514b1239589d9913c619540260a823c6eb19cc 100644 (file)
@@ -4744,8 +4744,7 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
     return;
 
   h = msymbol_hash (name) % HASH_SIZE;
-  e = (struct cache_entry *) obstack_alloc (&sym_cache->cache_space,
-                                           sizeof (*e));
+  e = XOBNEW (&sym_cache->cache_space, cache_entry);
   e->next = sym_cache->root[h];
   sym_cache->root[h] = e;
   e->name = copy
@@ -12805,11 +12804,9 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex,
       case ada_catch_exception:
         if (c->excep_string != NULL)
          {
-           char *info = xstrprintf (_("`%s' Ada exception"), c->excep_string);
-           struct cleanup *old_chain = make_cleanup (xfree, info);
-
-           uiout->text (info);
-           do_cleanups (old_chain);
+           std::string info = string_printf (_("`%s' Ada exception"),
+                                             c->excep_string);
+           uiout->text (info.c_str ());
          }
         else
           uiout->text (_("all Ada exceptions"));