forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
@@ -325,7 +325,7 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
|
||||
static SCM
|
||||
gdbscm_data_directory (void)
|
||||
{
|
||||
return gdbscm_scm_from_c_string (gdb_datadir);
|
||||
return gdbscm_scm_from_c_string (gdb_datadir.c_str ());
|
||||
}
|
||||
|
||||
/* (guile-data-directory) -> string */
|
||||
@@ -582,7 +582,8 @@ initialize_scheme_side (void)
|
||||
{
|
||||
char *boot_scm_path;
|
||||
|
||||
guile_datadir = concat (gdb_datadir, SLASH_STRING, "guile", (char *) NULL);
|
||||
guile_datadir = concat (gdb_datadir.c_str (), SLASH_STRING, "guile",
|
||||
(char *) NULL);
|
||||
boot_scm_path = concat (guile_datadir, SLASH_STRING, "gdb",
|
||||
SLASH_STRING, boot_scm_filename, (char *) NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user