aboutsummaryrefslogtreecommitdiff
path: root/gdb/psymtab.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-08-05 10:29:56 -0600
committerTom Tromey <tom@tromey.com>2017-08-22 09:30:12 -0600
commit0b581c69fe7186d7d0ea1283c7ecf9839a8827cc (patch)
treeb4aa2a0e6c53d2fadd33e3b05e04b234ba940de9 /gdb/psymtab.c
parent14278e1fdbe045df184d6dd546ff6a1e9e3c3797 (diff)
downloadgdb-0b581c69fe7186d7d0ea1283c7ecf9839a8827cc.zip
gdb-0b581c69fe7186d7d0ea1283c7ecf9839a8827cc.tar.gz
gdb-0b581c69fe7186d7d0ea1283c7ecf9839a8827cc.tar.bz2
Change rewrite_source_path to return a unique_xmalloc_ptr
This changes rewrite_source_path to return a unique_xmalloc_ptr and fixes up the callers. This allows removing some cleanups. ChangeLog 2017-08-22 Tom Tromey <tom@tromey.com> * source.h (rewrite_source_path): Return a unique_xmalloc_ptr. * source.c (rewrite_source_path): Return a unique_xmalloc_ptr. (find_and_open_source, symtab_to_fullname): Update. * psymtab.c (psymtab_to_fullname): Update.
Diffstat (limited to 'gdb/psymtab.c')
-rw-r--r--gdb/psymtab.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 8283545..6307d6e 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1199,23 +1199,20 @@ psymtab_to_fullname (struct partial_symtab *ps)
close (fd);
else
{
- char *fullname;
- struct cleanup *back_to;
+ gdb::unique_xmalloc_ptr<char> fullname;
/* rewrite_source_path would be applied by find_and_open_source, we
should report the pathname where GDB tried to find the file. */
if (ps->dirname == NULL || IS_ABSOLUTE_PATH (ps->filename))
- fullname = xstrdup (ps->filename);
+ fullname.reset (xstrdup (ps->filename));
else
- fullname = concat (ps->dirname, SLASH_STRING,
- ps->filename, (char *) NULL);
+ fullname.reset (concat (ps->dirname, SLASH_STRING,
+ ps->filename, (char *) NULL));
- back_to = make_cleanup (xfree, fullname);
- ps->fullname = rewrite_source_path (fullname);
+ ps->fullname = rewrite_source_path (fullname.get ()).release ();
if (ps->fullname == NULL)
- ps->fullname = xstrdup (fullname);
- do_cleanups (back_to);
+ ps->fullname = fullname.release ();
}
}