Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 3/3] Constify some remote-notif functions
Date: Sun, 06 Jan 2019 22:46:00 -0000	[thread overview]
Message-ID: <20190106224636.5271-4-tom@tromey.com> (raw)
In-Reply-To: <20190106224636.5271-1-tom@tromey.com>

This constifies the "buf" arguments to various remote-notif functions
and updates the users.

2019-01-06  Tom Tromey  <tom@tromey.com>

	* remote-notif.c (handle_notification, remote_notif_ack)
	(remote_notif_parse): Make "buf" const.
	* remote-notif.h (struct notif_client) <parse, ack>: Make "buf"
	const.
	(remote_notif_parse, remote_notif_ack, handle_notification):
	Likewise.
	* remote.c (remote_notif_stop_parse): Make "buf" const.
	(remote_target::remote_parse_stop_reply): Make "buf" const.
	(remote_notif_stop_ack): Make "buf" const.
---
 gdb/ChangeLog      | 12 ++++++++++++
 gdb/remote-notif.c |  6 +++---
 gdb/remote-notif.h | 11 ++++++-----
 gdb/remote.c       |  8 ++++----
 4 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index 9ccb5b9120..ae9a94d9c9 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -59,7 +59,7 @@ static void do_notif_event_xfree (void *arg);
 
 void
 remote_notif_ack (remote_target *remote,
-		  struct notif_client *nc, char *buf)
+		  struct notif_client *nc, const char *buf)
 {
   struct notif_event *event = nc->alloc_event ();
   struct cleanup *old_chain
@@ -79,7 +79,7 @@ remote_notif_ack (remote_target *remote,
 
 struct notif_event *
 remote_notif_parse (remote_target *remote,
-		    struct notif_client *nc, char *buf)
+		    struct notif_client *nc, const char *buf)
 {
   struct notif_event *event = nc->alloc_event ();
   struct cleanup *old_chain
@@ -126,7 +126,7 @@ remote_async_get_pending_events_handler (gdb_client_data data)
    update STATE.  */
 
 void
-handle_notification (struct remote_notif_state *state, char *buf)
+handle_notification (struct remote_notif_state *state, const char *buf)
 {
   struct notif_client *nc;
   size_t i;
diff --git a/gdb/remote-notif.h b/gdb/remote-notif.h
index a4a931b4b7..7973ad7fa0 100644
--- a/gdb/remote-notif.h
+++ b/gdb/remote-notif.h
@@ -55,13 +55,13 @@ typedef struct notif_client
      function may throw exception if contents in BUF is not the
      expected event.  */
   void (*parse) (remote_target *remote,
-		 struct notif_client *self, char *buf,
+		 struct notif_client *self, const char *buf,
 		 struct notif_event *event);
 
   /* Send field <ack_command> to remote, and do some checking.  If
      something wrong, throw an exception.  */
   void (*ack) (remote_target *remote,
-	       struct notif_client *self, char *buf,
+	       struct notif_client *self, const char *buf,
 	       struct notif_event *event);
 
   /* Check this notification client can get pending events in
@@ -106,15 +106,16 @@ struct remote_notif_state
   struct notif_event *pending_event[REMOTE_NOTIF_LAST];
 };
 
-void remote_notif_ack (remote_target *remote, notif_client *nc, char *buf);
+void remote_notif_ack (remote_target *remote, notif_client *nc,
+		       const char *buf);
 struct notif_event *remote_notif_parse (remote_target *remote,
 					notif_client *nc,
-					char *buf);
+					const char *buf);
 
 void notif_event_xfree (struct notif_event *event);
 
 void handle_notification (struct remote_notif_state *notif_state,
-			  char *buf);
+			  const char *buf);
 
 void remote_notif_process (struct remote_notif_state *state,
 			   struct notif_client *except);
diff --git a/gdb/remote.c b/gdb/remote.c
index 6b5870a70a..949c69c1cc 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -768,7 +768,7 @@ public: /* Remote specific methods.  */
   struct stop_reply *remote_notif_remove_queued_reply (ptid_t ptid);
   struct stop_reply *queued_stop_reply (ptid_t ptid);
   int peek_stop_reply (ptid_t ptid);
-  void remote_parse_stop_reply (char *buf, stop_reply *event);
+  void remote_parse_stop_reply (const char *buf, stop_reply *event);
 
   void remote_stop_ns (ptid_t ptid);
   void remote_interrupt_as ();
@@ -6864,7 +6864,7 @@ remote_target::stop_reply_queue_length ()
 
 void
 remote_notif_stop_parse (remote_target *remote,
-			 struct notif_client *self, char *buf,
+			 struct notif_client *self, const char *buf,
 			 struct notif_event *event)
 {
   remote->remote_parse_stop_reply (buf, (struct stop_reply *) event);
@@ -6872,7 +6872,7 @@ remote_notif_stop_parse (remote_target *remote,
 
 static void
 remote_notif_stop_ack (remote_target *remote,
-		       struct notif_client *self, char *buf,
+		       struct notif_client *self, const char *buf,
 		       struct notif_event *event)
 {
   struct stop_reply *stop_reply = (struct stop_reply *) event;
@@ -7201,7 +7201,7 @@ strprefix (const char *p, const char *pend, const char *prefix)
    result is stored in EVENT, or throws an error.  */
 
 void
-remote_target::remote_parse_stop_reply (char *buf, stop_reply *event)
+remote_target::remote_parse_stop_reply (const char *buf, stop_reply *event)
 {
   remote_arch_state *rsa = NULL;
   ULONGEST addr;
-- 
2.17.2


  reply	other threads:[~2019-01-06 22:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-06 22:46 [PATCH 0/3] Some remote-related constification Tom Tromey
2019-01-06 22:46 ` Tom Tromey [this message]
2019-01-06 22:46 ` [PATCH 1/3] Constify target_pass_signals and target_program_signals Tom Tromey
2019-01-14 22:03   ` Simon Marchi
2019-01-15  0:31     ` Tom Tromey
2019-01-23 18:46   ` [PATCH] target_pass_signals/target_program_signals: Use gdb::array_view (Re: [PATCH 1/3] Constify target_pass_signals and target_program_signals) Pedro Alves
2019-01-23 22:02     ` Tom Tromey
2019-01-06 22:46 ` [PATCH 2/3] Constify remote_console_output Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190106224636.5271-4-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox