[Ada] Better handling of dynamic types in ada_value_primitive_packed_val
[deliverable/binutils-gdb.git] / gdb / remote-notif.c
index 0d5927912b1b190a913c79a34fd60ac9434013a3..a8a628517b7fed780c4af9b7d5da7b9c26817da8 100644 (file)
@@ -1,6 +1,6 @@
 /* Remote notification in GDB protocol
 
-   Copyright (C) 1988-2013 Free Software Foundation, Inc.
+   Copyright (C) 1988-2015 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "event-loop.h"
 #include "target.h"
 #include "inferior.h"
+#include "infrun.h"
 #include "gdbcmd.h"
 
-#include <string.h>
-
 int notif_debug = 0;
 
 /* Supported clients of notifications.  */
@@ -118,7 +117,7 @@ static void
 remote_async_get_pending_events_handler (gdb_client_data data)
 {
   gdb_assert (non_stop);
-  remote_notif_process (data, NULL);
+  remote_notif_process ((struct remote_notif_state *) data, NULL);
 }
 
 /* Remote notification handler.  Parse BUF, queue notification and
@@ -127,22 +126,25 @@ remote_async_get_pending_events_handler (gdb_client_data data)
 void
 handle_notification (struct remote_notif_state *state, char *buf)
 {
-  struct notif_client *nc = NULL;
-  int i;
+  struct notif_client *nc;
+  size_t i;
 
   for (i = 0; i < ARRAY_SIZE (notifs); i++)
     {
-      nc = notifs[i];
-      if (strncmp (buf, nc->name, strlen (nc->name)) == 0
-         && buf[strlen (nc->name)] == ':')
+      const char *name = notifs[i]->name;
+
+      if (startswith (buf, name)
+         && buf[strlen (name)] == ':')
        break;
     }
 
   /* We ignore notifications we don't recognize, for compatibility
      with newer stubs.  */
-  if (nc == NULL)
+  if (i == ARRAY_SIZE (notifs))
     return;
 
+  nc =  notifs[i];
+
   if (state->pending_event[nc->id] != NULL)
     {
       /* We've already parsed the in-flight reply, but the stub for some
@@ -228,7 +230,7 @@ notif_event_xfree (struct notif_event *event)
 static void
 do_notif_event_xfree (void *arg)
 {
-  notif_event_xfree (arg);
+  notif_event_xfree ((struct notif_event *) arg);
 }
 
 /* Return an allocated remote_notif_state.  */
@@ -236,7 +238,7 @@ do_notif_event_xfree (void *arg)
 struct remote_notif_state *
 remote_notif_state_allocate (void)
 {
-  struct remote_notif_state *notif_state = xzalloc (sizeof (*notif_state));
+  struct remote_notif_state *notif_state = XCNEW (struct remote_notif_state);
 
   notif_state->notif_queue = QUEUE_alloc (notif_client_p, NULL);
 
This page took 0.026085 seconds and 4 git commands to generate.