This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Constify some commands in btrace.c
- From: Tom Tromey <tromey at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 27 Sep 2017 14:57:50 -0000
- Subject: [binutils-gdb] Constify some commands in btrace.c
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f938677d425cd0453e26f7f51d9e94c87c92a25d
commit f938677d425cd0453e26f7f51d9e94c87c92a25d
Author: Tom Tromey <tom@tromey.com>
Date: Tue Sep 12 21:12:42 2017 -0600
Constify some commands in btrace.c
gdb/ChangeLog
2017-09-27 Tom Tromey <tom@tromey.com>
* btrace.c (get_uint, get_context_size, no_chunk)
(maint_btrace_packet_history_cmd)
(maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd)
(maint_info_btrace_cmd): Constify.
Diff:
---
gdb/ChangeLog | 7 +++++++
gdb/btrace.c | 27 ++++++++++++++-------------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b3a6611..d75a921 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2017-09-27 Tom Tromey <tom@tromey.com>
+ * btrace.c (get_uint, get_context_size, no_chunk)
+ (maint_btrace_packet_history_cmd)
+ (maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd)
+ (maint_info_btrace_cmd): Constify.
+
+2017-09-27 Tom Tromey <tom@tromey.com>
+
* reverse.c (delete_bookmark_command): Constify.
2017-09-27 Tom Tromey <tom@tromey.com>
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 8527c6f..7990d5f 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3180,9 +3180,10 @@ btrace_maint_print_packets (struct btrace_thread_info *btinfo,
/* Read a number from an argument string. */
static unsigned int
-get_uint (char **arg)
+get_uint (const char **arg)
{
- char *begin, *end, *pos;
+ const char *begin, *pos;
+ char *end;
unsigned long number;
begin = *arg;
@@ -3203,23 +3204,23 @@ get_uint (char **arg)
/* Read a context size from an argument string. */
static int
-get_context_size (char **arg)
+get_context_size (const char **arg)
{
- char *pos;
- int number;
-
- pos = skip_spaces (*arg);
+ const char *pos = skip_spaces (*arg);
if (!isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
- return strtol (pos, arg, 10);
+ char *end;
+ long result = strtol (pos, &end, 10);
+ *arg = end;
+ return result;
}
/* Complain about junk at the end of an argument string. */
static void
-no_chunk (char *arg)
+no_chunk (const char *arg)
{
if (*arg != 0)
error (_("Junk after argument: %s."), arg);
@@ -3228,7 +3229,7 @@ no_chunk (char *arg)
/* The "maintenance btrace packet-history" command. */
static void
-maint_btrace_packet_history_cmd (char *arg, int from_tty)
+maint_btrace_packet_history_cmd (const char *arg, int from_tty)
{
struct btrace_thread_info *btinfo;
struct thread_info *tp;
@@ -3333,7 +3334,7 @@ maint_btrace_packet_history_cmd (char *arg, int from_tty)
/* The "maintenance btrace clear-packet-history" command. */
static void
-maint_btrace_clear_packet_history_cmd (char *args, int from_tty)
+maint_btrace_clear_packet_history_cmd (const char *args, int from_tty)
{
struct btrace_thread_info *btinfo;
struct thread_info *tp;
@@ -3355,7 +3356,7 @@ maint_btrace_clear_packet_history_cmd (char *args, int from_tty)
/* The "maintenance btrace clear" command. */
static void
-maint_btrace_clear_cmd (char *args, int from_tty)
+maint_btrace_clear_cmd (const char *args, int from_tty)
{
struct btrace_thread_info *btinfo;
struct thread_info *tp;
@@ -3418,7 +3419,7 @@ maint_btrace_pt_show_cmd (char *args, int from_tty)
/* The "maintenance info btrace" command. */
static void
-maint_info_btrace_cmd (char *args, int from_tty)
+maint_info_btrace_cmd (const char *args, int from_tty)
{
struct btrace_thread_info *btinfo;
struct thread_info *tp;