aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-12 21:20:36 -0600
committerTom Tromey <tom@tromey.com>2017-09-27 08:45:03 -0600
commit69f476a36f475210807cb70d10183df9b838a9eb (patch)
treec3ebaaccb84e1376b0ad01e3c9575c8b883e886d /gdb/infcmd.c
parentc4a3e68e33b78c68d63c35bbed01782ff9eff4d1 (diff)
downloadgdb-69f476a36f475210807cb70d10183df9b838a9eb.zip
gdb-69f476a36f475210807cb70d10183df9b838a9eb.tar.gz
gdb-69f476a36f475210807cb70d10183df9b838a9eb.tar.bz2
Constify some commands in infcmd.c
gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * infcmd.c (environment_info, set_environment_command) (unset_environment_command, path_info, info_proc_cmd_1) (info_proc_cmd_mappings, info_proc_cmd_stat) (info_proc_cmd_status, info_proc_cmd_cwd, info_proc_cmd_cmdline) (info_proc_cmd_exe, info_proc_cmd_all): Constify.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9c0cead..da16f5e 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -68,8 +68,6 @@ static void until_next_command (int);
static void until_command (char *, int);
-static void path_info (char *, int);
-
static void path_command (char *, int);
static void unset_command (char *, int);
@@ -78,12 +76,6 @@ static void info_float_command (char *, int);
static void disconnect_command (char *, int);
-static void unset_environment_command (char *, int);
-
-static void set_environment_command (char *, int);
-
-static void environment_info (char *, int);
-
static void info_program_command (char *, int);
static void finish_command (char *, int);
@@ -2148,7 +2140,7 @@ info_program_command (char *args, int from_tty)
}
static void
-environment_info (char *var, int from_tty)
+environment_info (const char *var, int from_tty)
{
if (var)
{
@@ -2181,9 +2173,9 @@ environment_info (char *var, int from_tty)
}
static void
-set_environment_command (char *arg, int from_tty)
+set_environment_command (const char *arg, int from_tty)
{
- char *p, *val, *var;
+ const char *p, *val;
int nullset = 0;
if (arg == 0)
@@ -2230,21 +2222,20 @@ set_environment_command (char *arg, int from_tty)
while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
p--;
- var = savestring (arg, p - arg);
+ std::string var (arg, p - arg);
if (nullset)
{
printf_filtered (_("Setting environment variable "
"\"%s\" to null value.\n"),
- var);
- current_inferior ()->environment.set (var, "");
+ var.c_str ());
+ current_inferior ()->environment.set (var.c_str (), "");
}
else
- current_inferior ()->environment.set (var, val);
- xfree (var);
+ current_inferior ()->environment.set (var.c_str (), val);
}
static void
-unset_environment_command (char *var, int from_tty)
+unset_environment_command (const char *var, int from_tty)
{
if (var == 0)
{
@@ -2262,7 +2253,7 @@ unset_environment_command (char *var, int from_tty)
static const char path_var_name[] = "PATH";
static void
-path_info (char *args, int from_tty)
+path_info (const char *args, int from_tty)
{
puts_filtered ("Executable and object file path: ");
puts_filtered (current_inferior ()->environment.get (path_var_name));
@@ -3133,7 +3124,7 @@ unset_command (char *args, int from_tty)
/* Implement `info proc' family of commands. */
static void
-info_proc_cmd_1 (char *args, enum info_proc_what what, int from_tty)
+info_proc_cmd_1 (const char *args, enum info_proc_what what, int from_tty)
{
struct gdbarch *gdbarch = get_current_arch ();
@@ -3157,7 +3148,7 @@ info_proc_cmd (char *args, int from_tty)
/* Implement `info proc mappings'. */
static void
-info_proc_cmd_mappings (char *args, int from_tty)
+info_proc_cmd_mappings (const char *args, int from_tty)
{
info_proc_cmd_1 (args, IP_MAPPINGS, from_tty);
}
@@ -3165,7 +3156,7 @@ info_proc_cmd_mappings (char *args, int from_tty)
/* Implement `info proc stat'. */
static void
-info_proc_cmd_stat (char *args, int from_tty)
+info_proc_cmd_stat (const char *args, int from_tty)
{
info_proc_cmd_1 (args, IP_STAT, from_tty);
}
@@ -3173,7 +3164,7 @@ info_proc_cmd_stat (char *args, int from_tty)
/* Implement `info proc status'. */
static void
-info_proc_cmd_status (char *args, int from_tty)
+info_proc_cmd_status (const char *args, int from_tty)
{
info_proc_cmd_1 (args, IP_STATUS, from_tty);
}
@@ -3181,7 +3172,7 @@ info_proc_cmd_status (char *args, int from_tty)
/* Implement `info proc cwd'. */
static void
-info_proc_cmd_cwd (char *args, int from_tty)
+info_proc_cmd_cwd (const char *args, int from_tty)
{
info_proc_cmd_1 (args, IP_CWD, from_tty);
}
@@ -3189,7 +3180,7 @@ info_proc_cmd_cwd (char *args, int from_tty)
/* Implement `info proc cmdline'. */
static void
-info_proc_cmd_cmdline (char *args, int from_tty)
+info_proc_cmd_cmdline (const char *args, int from_tty)
{
info_proc_cmd_1 (args, IP_CMDLINE, from_tty);
}
@@ -3197,7 +3188,7 @@ info_proc_cmd_cmdline (char *args, int from_tty)
/* Implement `info proc exe'. */
static void
-info_proc_cmd_exe (char *args, int from_tty)
+info_proc_cmd_exe (const char *args, int from_tty)
{
info_proc_cmd_1 (args, IP_EXE, from_tty);
}
@@ -3205,7 +3196,7 @@ info_proc_cmd_exe (char *args, int from_tty)
/* Implement `info proc all'. */
static void
-info_proc_cmd_all (char *args, int from_tty)
+info_proc_cmd_all (const char *args, int from_tty)
{
info_proc_cmd_1 (args, IP_ALL, from_tty);
}