From d721ba37d8995b9c11a0b8eef0f4d2dc022f85aa Mon Sep 17 00:00:00 2001 From: Pedro Alves <palves@redhat.com> Date: Mon, 27 Mar 2017 11:56:28 +0100 Subject: gdb: Make ldirname return a std::string Eliminates several uses of cleanups. Tested on x86_64 Fedora 23 with Python 2 and 3. gdb/ChangeLog 2017-03-27 Pedro Alves <palves@redhat.com> * dwarf2read.c (struct file_and_directory): New. (dwarf2_get_dwz_file): Adjust to use std::string. (dw2_get_file_names_reader): Adjust to use file_and_directory. (find_file_and_directory): Adjust to return a file_and_directory object. (read_file_scope): Adjust to use file_and_directory. Remove make_cleanup/do_cleanups calls. (open_and_init_dwp_file): Adjust to use std::string. Remove make_cleanup/do_cleanups calls. * python/python.c (do_start_initialization): Adjust to ldirname returning a std::string. * utils.c (ldirname): Now returns a std::string. * utils.h (ldirname): Change return type to std::string. * xml-syscall.c (xml_init_syscalls_info): Adjust to ldirname returning a std::string. * xml-tdesc.c (file_read_description_xml): Likewise. --- gdb/python/python.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gdb/python/python.c') diff --git a/gdb/python/python.c b/gdb/python/python.c index d21e023..a7aff53 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1550,10 +1550,8 @@ do_start_initialization () /foo/bin/python /foo/lib/pythonX.Y/... This must be done before calling Py_Initialize. */ - char *libdir = ldirname (python_libdir); - progname = concat (libdir, SLASH_STRING, "bin", + progname = concat (ldirname (python_libdir).c_str (), SLASH_STRING, "bin", SLASH_STRING, "python", (char *) NULL); - xfree (libdir); #ifdef IS_PY3K oldloc = xstrdup (setlocale (LC_ALL, NULL)); setlocale (LC_ALL, ""); -- cgit v1.1