/* 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. */
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 (strncmp (buf, name, strlen (name)) == 0
+ && 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