diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-04-07 16:43:05 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-04-07 20:31:31 -0400 |
commit | d3a76a5583ddb34402e79969f61f195cfa08ad62 (patch) | |
tree | b61bcdf6d658235c0eabd0e73d30c17d7bca72f3 /gdb/dwarf2/line-header.c | |
parent | a32c49c6dd0c80e4a06e23bebde7149d79cd48ee (diff) | |
download | binutils-gdb-d3a76a5583ddb34402e79969f61f195cfa08ad62.tar.gz |
gdb: change file_file_name to return an std::string
Straightforward change, return an std::string instead of a
gdb::unique_xmalloc_ptr<char>. No behavior change expected.
Change-Id: Ia5e94c94221c35f978bb1b7bdffbff7209e0520e
Diffstat (limited to 'gdb/dwarf2/line-header.c')
-rw-r--r-- | gdb/dwarf2/line-header.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/gdb/dwarf2/line-header.c b/gdb/dwarf2/line-header.c index 4807fcaa583..77e7e553b21 100644 --- a/gdb/dwarf2/line-header.c +++ b/gdb/dwarf2/line-header.c @@ -60,7 +60,7 @@ line_header::add_file_name (const char *name, m_file_names.emplace_back (name, d_index, mod_time, length); } -gdb::unique_xmalloc_ptr<char> +std::string line_header::file_file_name (int file) const { /* Is the file number a valid index into the line header's file name @@ -73,26 +73,20 @@ line_header::file_file_name (int file) const { const char *dir = fe->include_dir (this); if (dir != NULL) - return gdb::unique_xmalloc_ptr<char> (concat (dir, SLASH_STRING, - fe->name, - (char *) NULL)); + return string_printf ("%s/%s", dir, fe->name); } - return make_unique_xstrdup (fe->name); + + return fe->name; } else { /* The compiler produced a bogus file number. We can at least record the macro definitions made in the file, even if we won't be able to find the file by name. */ - char fake_name[80]; - - xsnprintf (fake_name, sizeof (fake_name), - "<bad macro file number %d>", file); - complaint (_("bad file number in macro information (%d)"), file); - return make_unique_xstrdup (fake_name); + return string_printf ("<bad macro file number %d>", file); } } |