Use std::string in Rust code
[deliverable/binutils-gdb.git] / gdb / rust-exp.y
index a97ca67f46e92982c40e7846b4a0a579ffac5a24..98301a48922eeda75cf8bb55f00158c187cc3985 100644 (file)
@@ -941,16 +941,15 @@ rust_concat3 (const char *s1, const char *s2, const char *s3)
 static const struct rust_op *
 crate_name (const struct rust_op *name)
 {
-  char *crate = rust_crate_for_block (expression_context_block);
+  std::string crate = rust_crate_for_block (expression_context_block);
   struct stoken result;
 
   gdb_assert (name->opcode == OP_VAR_VALUE);
 
-  if (crate == NULL)
+  if (crate.empty ())
     error (_("Could not find crate for current location"));
-  result = make_stoken (obconcat (&work_obstack, "::", crate, "::",
+  result = make_stoken (obconcat (&work_obstack, "::", crate.c_str (), "::",
                                  name->left.sval.ptr, (char *) NULL));
-  xfree (crate);
 
   return ast_path (result, name->right.params);
 }
This page took 0.024088 seconds and 4 git commands to generate.