constify deprecate_cmd

This constifies deprecate_cmd and the "replacement" field in struct
cmd_list_element.

2014-07-24  Tom Tromey  <tromey@redhat.com>

	* cli/cli-decode.c (deprecate_cmd): Make "replacement" const.
	* cli/cli-decode.h (struct cmd_list_element) <replacement>: Now
	const.
	* command.h (deprecate_cmd): Update.
	* maint.c (maintenance_do_deprecate): Add casts.
This commit is contained in:
Tom Tromey
2014-07-21 20:37:34 -06:00
parent 64669f3b4b
commit 429e55ea94
5 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2014-07-24 Tom Tromey <tromey@redhat.com>
* cli/cli-decode.c (deprecate_cmd): Make "replacement" const.
* cli/cli-decode.h (struct cmd_list_element) <replacement>: Now
const.
* command.h (deprecate_cmd): Update.
* maint.c (maintenance_do_deprecate): Add casts.
2014-07-24 Tom Tromey <tromey@redhat.com> 2014-07-24 Tom Tromey <tromey@redhat.com>
* cli/cli-decode.c (help_cmd): Make parameter "const". * cli/cli-decode.c (help_cmd): Make parameter "const".

View File

@ -261,7 +261,7 @@ add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun,
Returns a pointer to the deprecated command. */ Returns a pointer to the deprecated command. */
struct cmd_list_element * struct cmd_list_element *
deprecate_cmd (struct cmd_list_element *cmd, char *replacement) deprecate_cmd (struct cmd_list_element *cmd, const char *replacement)
{ {
cmd->cmd_deprecated = 1; cmd->cmd_deprecated = 1;
cmd->deprecated_warn_user = 1; cmd->deprecated_warn_user = 1;

View File

@ -135,7 +135,7 @@ struct cmd_list_element
show_value_ftype *show_value_func; show_value_ftype *show_value_func;
/* If this command is deprecated, this is the replacement name. */ /* If this command is deprecated, this is the replacement name. */
char *replacement; const char *replacement;
/* If this command represents a show command, then this function /* If this command represents a show command, then this function
is called before the variable's value is examined. */ is called before the variable's value is examined. */

View File

@ -194,7 +194,7 @@ extern struct cmd_list_element *lookup_cmd_1 (const char **,
int); int);
extern struct cmd_list_element *deprecate_cmd (struct cmd_list_element *, extern struct cmd_list_element *deprecate_cmd (struct cmd_list_element *,
char * ); const char * );
extern void deprecated_cmd_warning (const char *); extern void deprecated_cmd_warning (const char *);

View File

@ -628,7 +628,7 @@ maintenance_do_deprecate (char *text, int deprecate)
if (alias) if (alias)
{ {
if (alias->malloced_replacement) if (alias->malloced_replacement)
xfree (alias->replacement); xfree ((char *) alias->replacement);
if (deprecate) if (deprecate)
{ {
@ -647,7 +647,7 @@ maintenance_do_deprecate (char *text, int deprecate)
else if (cmd) else if (cmd)
{ {
if (cmd->malloced_replacement) if (cmd->malloced_replacement)
xfree (cmd->replacement); xfree ((char *) cmd->replacement);
if (deprecate) if (deprecate)
{ {