From patchwork Mon Sep 21 22:50:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 8816 Received: (qmail 55813 invoked by alias); 21 Sep 2015 22:50:22 -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 55800 invoked by uid 89); 21 Sep 2015 22:50:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_20, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 21 Sep 2015 22:50:20 +0000 Received: from EUSAAHC008.ericsson.se (Unknown_Domain [147.117.188.96]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 35.36.32596.89A20065; Mon, 21 Sep 2015 18:04:40 +0200 (CEST) Received: from elxcz23q12-y4.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.96) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 21 Sep 2015 18:50:17 -0400 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH/obv] Add two missing consts Date: Mon, 21 Sep 2015 18:50:14 -0400 Message-ID: <1442875814-20181-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes FYI. Two missing consts, found while doing cxx-conversion work. We end up with a char*, even though we pass a const char* to strstr. I am pushing this as obvious. gdb/ChangeLog: * cli/cli-setshow.c (cmd_show_list): Constify a variable. * linespec.c (linespec_lexer_lex_string): Same. --- gdb/ChangeLog | 5 +++++ gdb/cli/cli-setshow.c | 2 +- gdb/linespec.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 96bf4e0..188bfb2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2015-09-21 Simon Marchi + + * cli/cli-setshow.c (cmd_show_list): Constify a variable. + * linespec.c (linespec_lexer_lex_string): Same. + 2015-09-21 Pierre Langlois * NEWS: Mention support for fast tracepoints on aarch64-linux. diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index ca41d8e..64f09f2 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -683,7 +683,7 @@ cmd_show_list (struct cmd_list_element *list, int from_tty, const char *prefix) { struct cleanup *optionlist_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "optionlist"); - char *new_prefix = strstr (list->prefixname, "show ") + 5; + const char *new_prefix = strstr (list->prefixname, "show ") + 5; if (ui_out_is_mi_like_p (uiout)) ui_out_field_string (uiout, "prefix", new_prefix); diff --git a/gdb/linespec.c b/gdb/linespec.c index 4c29c12..7a595ed 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -669,7 +669,7 @@ linespec_lexer_lex_string (linespec_parser *parser) && (PARSER_STREAM (parser) - start) > 8 /* strlen ("operator") */) { - char *p = strstr (start, "operator"); + const char *p = strstr (start, "operator"); if (p != NULL && is_operator_name (p)) {