diff options
author | Tom Tromey <tom@tromey.com> | 2017-02-02 20:58:12 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-02-02 21:25:11 -0700 |
commit | 03c85b11b07452f2d7341b405a7fe70c74226505 (patch) | |
tree | 3d87dc1f816b12136c8d84ad0bb23647330b7617 /gdb/rust-lang.h | |
parent | 73dceb99fa57b79e83a6ed80aaad49d0e3e7da66 (diff) | |
download | gdb-03c85b11b07452f2d7341b405a7fe70c74226505.zip gdb-03c85b11b07452f2d7341b405a7fe70c74226505.tar.gz gdb-03c85b11b07452f2d7341b405a7fe70c74226505.tar.bz2 |
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.
Diffstat (limited to 'gdb/rust-lang.h')
-rw-r--r-- | gdb/rust-lang.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/gdb/rust-lang.h b/gdb/rust-lang.h index 70da69f..6c627ae 100644 --- a/gdb/rust-lang.h +++ b/gdb/rust-lang.h @@ -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 |