Use std::string in Rust code

This changes a couple of spots in the Rust support to use std::string.
In one spot this removes some manual memory management; in the other
spot this allows the removal of a call to xstrdup.

2017-02-02  Tom Tromey  <tom@tromey.com>

	* rust-lang.h (rust_crate_for_block): Update.
	* rust-lang.c (rust_crate_for_block): Return std::string.
	(rust_get_disr_info): Use std:;string, not
	gdb::unique_xmalloc_ptr.
	* rust-exp.y (crate_name): Update.
This commit is contained in:
Tom Tromey 2017-02-02 20:58:12 -07:00
parent 73dceb99fa
commit 03c85b11b0
4 changed files with 20 additions and 16 deletions

View file

@ -35,10 +35,9 @@ extern int rust_tuple_type_p (struct type *type);
/* Return true if TYPE is a tuple struct type; otherwise false. */
extern int rust_tuple_struct_type_p (struct type *type);
/* Given a block, find the name of the block's crate. The name must
be freed by the caller. Returns NULL if no crate name can be
found. */
extern char *rust_crate_for_block (const struct block *block);
/* Given a block, find the name of the block's crate. Returns an empty
stringif no crate name can be found. */
extern std::string rust_crate_for_block (const struct block *block);
/* Create a new slice type. NAME is the name of the type. ELT_TYPE
is the type of the elements of the slice. USIZE_TYPE is the Rust