From f2aec7f6d149c8a534e8246b0d3a50038864fa2d Mon Sep 17 00:00:00 2001
From: Christian Biesinger <cbiesinger@google.com>
Date: Mon, 9 Sep 2019 12:55:39 -0500
Subject: Make relocate_{path,gdb_directory} return std::string

This simplifies memory management. I've also changed some global variables
to std::string accordingly (which store the result of these functions),
but not all because some are used with add_setshow_optional_filename_cmd
which requires a char*.

gdb/ChangeLog:

2019-09-11  Christian Biesinger  <cbiesinger@google.com>

	* auto-load.c (auto_load_expand_dir_vars): Update.
	* defs.h (gdb_datadir): Change to std::string.
	(python_libdir): Likewise.
	(relocate_gdb_directory): Change return type to std::string.
	* guile/guile.c (gdbscm_data_directory): Update.
	(initialize_scheme_side): Update.
	* jit.c (jit_reader_dir): Change to std::string.
	(jit_reader_load_command): Update.
	* main.c (gdb_datadir): Change to std::string.
	(python_libdir): Likewise.
	(set_gdb_data_directory): Update.
	(relocate_path): Change to return std::string.
	(relocate_gdb_directory): Change to return std::string.
	(relocate_gdbinit_path_maybe_in_datadir): Update.
	(captured_main_1): Update.
	* python/python.c (do_start_initialization): Update.
	* top.c (show_gdb_datadir): Update.
	* xml-syscall.c (xml_init_syscalls_info): Update.
	(init_syscalls_info): Update.
---
 gdb/python/python.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'gdb/python/python.c')

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 9c49151..9c8c635 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1608,7 +1608,7 @@ do_start_initialization ()
      /foo/lib/pythonX.Y/...
      This must be done before calling Py_Initialize.  */
   gdb::unique_xmalloc_ptr<char> progname
-    (concat (ldirname (python_libdir).c_str (), SLASH_STRING, "bin",
+    (concat (ldirname (python_libdir.c_str ()).c_str (), SLASH_STRING, "bin",
 	      SLASH_STRING, "python", (char *) NULL));
 #ifdef IS_PY3K
   std::string oldloc = setlocale (LC_ALL, NULL);
-- 
cgit v1.1