+2013-12-11 Yao Qi <yao@codesourcery.com>
+
+ * notif.c (handle_notif_ack): Return 0 if no notification
+ matches.
+
2013-11-20 Doug Evans <dje@google.com>
* linux-low.c (linux_set_resume_request): Fix comment.
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 (strncmp (own_buf, ack_name, strlen (ack_name)) == 0
+ && 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))