[06/13] constify remote.c
Commit Message
This does some more constification in remote.c.
2014-07-22 Tom Tromey <tromey@redhat.com>
* remote.c (remote_serial_open, print_packet, putpkt)
(putpkt_binary): Constify.
* remote.h (putpkt): Update.
---
gdb/ChangeLog | 6 ++++++
gdb/remote.c | 12 ++++++------
gdb/remote.h | 2 +-
3 files changed, 13 insertions(+), 7 deletions(-)
Comments
Nice, looks good.
Thanks,
Pedro Alves
On 07/22/2014 07:55 PM, Tom Tromey wrote:
> This does some more constification in remote.c.
>
> 2014-07-22 Tom Tromey <tromey@redhat.com>
>
> * remote.c (remote_serial_open, print_packet, putpkt)
> (putpkt_binary): Constify.
> * remote.h (putpkt): Update.
> ---
> gdb/ChangeLog | 6 ++++++
> gdb/remote.c | 12 ++++++------
> gdb/remote.h | 2 +-
> 3 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/gdb/remote.c b/gdb/remote.c
> index 29c03bc..972c0ff 100644
> --- a/gdb/remote.c
> +++ b/gdb/remote.c
> @@ -164,7 +164,7 @@ static int hexnumnstr (char *, ULONGEST, int);
>
> static CORE_ADDR remote_address_masked (CORE_ADDR);
>
> -static void print_packet (char *);
> +static void print_packet (const char *);
>
> static void compare_sections_command (char *, int);
>
> @@ -176,7 +176,7 @@ static ptid_t remote_current_thread (ptid_t oldptid);
>
> static void remote_find_new_threads (void);
>
> -static int putpkt_binary (char *buf, int cnt);
> +static int putpkt_binary (const char *buf, int cnt);
>
> static void check_binary_download (CORE_ADDR addr);
>
> @@ -3727,7 +3727,7 @@ remote_check_symbols (void)
> }
>
> static struct serial *
> -remote_serial_open (char *name)
> +remote_serial_open (const char *name)
> {
> static int udp_warning = 0;
>
> @@ -7109,7 +7109,7 @@ escape_buffer (const char *buf, int n)
> string notation. */
>
> static void
> -print_packet (char *buf)
> +print_packet (const char *buf)
> {
> puts_filtered ("\"");
> fputstr_filtered (buf, '"', gdb_stdout);
> @@ -7117,7 +7117,7 @@ print_packet (char *buf)
> }
>
> int
> -putpkt (char *buf)
> +putpkt (const char *buf)
> {
> return putpkt_binary (buf, strlen (buf));
> }
> @@ -7129,7 +7129,7 @@ putpkt (char *buf)
> to print the sent packet as a string. */
>
> static int
> -putpkt_binary (char *buf, int cnt)
> +putpkt_binary (const char *buf, int cnt)
> {
> struct remote_state *rs = get_remote_state ();
> int i;
> diff --git a/gdb/remote.h b/gdb/remote.h
> index 46b73d9..7006346 100644
> --- a/gdb/remote.h
> +++ b/gdb/remote.h
> @@ -37,7 +37,7 @@ extern void getpkt (char **buf, long *sizeof_buf, int forever);
> we are debugging (remote_debug) and want to print the sent packet
> as a string. */
>
> -extern int putpkt (char *buf);
> +extern int putpkt (const char *buf);
>
> void register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
> const struct target_desc *tdesc);
>
@@ -164,7 +164,7 @@ static int hexnumnstr (char *, ULONGEST, int);
static CORE_ADDR remote_address_masked (CORE_ADDR);
-static void print_packet (char *);
+static void print_packet (const char *);
static void compare_sections_command (char *, int);
@@ -176,7 +176,7 @@ static ptid_t remote_current_thread (ptid_t oldptid);
static void remote_find_new_threads (void);
-static int putpkt_binary (char *buf, int cnt);
+static int putpkt_binary (const char *buf, int cnt);
static void check_binary_download (CORE_ADDR addr);
@@ -3727,7 +3727,7 @@ remote_check_symbols (void)
}
static struct serial *
-remote_serial_open (char *name)
+remote_serial_open (const char *name)
{
static int udp_warning = 0;
@@ -7109,7 +7109,7 @@ escape_buffer (const char *buf, int n)
string notation. */
static void
-print_packet (char *buf)
+print_packet (const char *buf)
{
puts_filtered ("\"");
fputstr_filtered (buf, '"', gdb_stdout);
@@ -7117,7 +7117,7 @@ print_packet (char *buf)
}
int
-putpkt (char *buf)
+putpkt (const char *buf)
{
return putpkt_binary (buf, strlen (buf));
}
@@ -7129,7 +7129,7 @@ putpkt (char *buf)
to print the sent packet as a string. */
static int
-putpkt_binary (char *buf, int cnt)
+putpkt_binary (const char *buf, int cnt)
{
struct remote_state *rs = get_remote_state ();
int i;
@@ -37,7 +37,7 @@ extern void getpkt (char **buf, long *sizeof_buf, int forever);
we are debugging (remote_debug) and want to print the sent packet
as a string. */
-extern int putpkt (char *buf);
+extern int putpkt (const char *buf);
void register_remote_g_packet_guess (struct gdbarch *gdbarch, int bytes,
const struct target_desc *tdesc);