From patchwork Tue Jul 22 18:55:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 2141 Received: (qmail 26429 invoked by alias); 22 Jul 2014 18:55:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 26359 invoked by uid 89); 22 Jul 2014 18:55:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 22 Jul 2014 18:55:36 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6MItYWI017433 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 22 Jul 2014 14:55:35 -0400 Received: from barimba.redhat.com (ovpn-113-154.phx2.redhat.com [10.3.113.154]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6MItMWZ000387; Tue, 22 Jul 2014 14:55:34 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 10/13] constify deprecate_cmd Date: Tue, 22 Jul 2014 12:55:16 -0600 Message-Id: <1406055319-26380-11-git-send-email-tromey@redhat.com> In-Reply-To: <1406055319-26380-1-git-send-email-tromey@redhat.com> References: <1406055319-26380-1-git-send-email-tromey@redhat.com> This constifies deprecate_cmd and the "replacement" field in struct cmd_list_element. 2014-07-22 Tom Tromey * cli/cli-decode.c (deprecate_cmd): Make "replacement" const. * cli/cli-decode.h (struct cmd_list_element) : Now const. * command.h (deprecate_cmd): Update. * maint.c (maintenance_do_deprecate): Add casts. --- gdb/ChangeLog | 8 ++++++++ gdb/cli/cli-decode.c | 2 +- gdb/cli/cli-decode.h | 2 +- gdb/command.h | 2 +- gdb/maint.c | 4 ++-- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index fcd4ceb..a08cc45 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -261,7 +261,7 @@ add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun, Returns a pointer to the deprecated command. */ 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->deprecated_warn_user = 1; diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 48ed604..9cd887d 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -135,7 +135,7 @@ struct cmd_list_element show_value_ftype *show_value_func; /* 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 is called before the variable's value is examined. */ diff --git a/gdb/command.h b/gdb/command.h index 5761447..1d63d2b 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -194,7 +194,7 @@ extern struct cmd_list_element *lookup_cmd_1 (const char **, int); extern struct cmd_list_element *deprecate_cmd (struct cmd_list_element *, - char * ); + const char * ); extern void deprecated_cmd_warning (const char *); diff --git a/gdb/maint.c b/gdb/maint.c index 336856c..3472c35 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -628,7 +628,7 @@ maintenance_do_deprecate (char *text, int deprecate) if (alias) { if (alias->malloced_replacement) - xfree (alias->replacement); + xfree ((char *) alias->replacement); if (deprecate) { @@ -647,7 +647,7 @@ maintenance_do_deprecate (char *text, int deprecate) else if (cmd) { if (cmd->malloced_replacement) - xfree (cmd->replacement); + xfree ((char *) cmd->replacement); if (deprecate) {