[PowerPC] Consolidate linux vector regset sizes
[deliverable/binutils-gdb.git] / gdb / gdbserver / notif.c
index 0713b369ae1dbb993df1f906f0c3cc7368bc865e..5ff7079123f3f694b4e39635fed9b577a0deeab6 100644 (file)
@@ -1,6 +1,5 @@
 /* Notification to GDB.
-   Copyright (C) 1989, 1993-1995, 1997-2000, 2002-2012 Free Software
-   Foundation, Inc.
+   Copyright (C) 1989-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -48,6 +47,7 @@
 
    # 3 is done by function 'handle_notif_ack'.  */
 
+#include "server.h"
 #include "notif.h"
 
 static struct notif_server *notifs[] =
@@ -79,20 +79,23 @@ notif_write_event (struct notif_server *notif, char *own_buf)
 int
 handle_notif_ack (char *own_buf, int packet_len)
 {
-  int i = 0;
-  struct notif_server *np = NULL;
+  size_t i;
+  struct notif_server *np;
 
   for (i = 0; i < ARRAY_SIZE (notifs); i++)
     {
-      np = notifs[i];
-      if (strncmp (own_buf, np->ack_name, strlen (np->ack_name)) == 0
-         && packet_len == strlen (np->ack_name))
+      const char *ack_name = notifs[i]->ack_name;
+
+      if (startswith (own_buf, ack_name)
+         && packet_len == strlen (ack_name))
        break;
     }
 
-  if (np == NULL)
+  if (i == ARRAY_SIZE (notifs))
     return 0;
 
+  np = notifs[i];
+
   /* If we're waiting for GDB to acknowledge a pending event,
      consider that done.  */
   if (!QUEUE_is_empty (notif_event_p, np->queue))
@@ -101,8 +104,8 @@ handle_notif_ack (char *own_buf, int packet_len)
        = QUEUE_deque (notif_event_p, np->queue);
 
       if (remote_debug)
-       fprintf (stderr, "%s: acking %d\n", np->ack_name,
-                QUEUE_length (notif_event_p, np->queue));
+       debug_printf ("%s: acking %d\n", np->ack_name,
+                     QUEUE_length (notif_event_p, np->queue));
 
       xfree (head);
     }
@@ -121,8 +124,8 @@ notif_event_enque (struct notif_server *notif,
   QUEUE_enque (notif_event_p, notif->queue, event);
 
   if (remote_debug)
-    fprintf (stderr, "pending events: %s %d\n", notif->notif_name,
-            QUEUE_length (notif_event_p, notif->queue));
+    debug_printf ("pending events: %s %d\n", notif->notif_name,
+                 QUEUE_length (notif_event_p, notif->queue));
 
 }
 
This page took 0.024595 seconds and 4 git commands to generate.