X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fgdbserver%2Fnotif.c;h=945516798d599ceac610e0d48a412cb5cead248c;hb=476350ba4800f1144b125f6511a5e25b223cc90b;hp=e27746e43872c5796988bcec248a854233ceea11;hpb=28e7fd62340426746f9c896cbc40c5d374ec47aa;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/gdbserver/notif.c b/gdb/gdbserver/notif.c index e27746e438..945516798d 100644 --- a/gdb/gdbserver/notif.c +++ b/gdb/gdbserver/notif.c @@ -1,5 +1,5 @@ /* Notification to GDB. - Copyright (C) 1989-2013 Free Software Foundation, Inc. + Copyright (C) 1989-2016 Free Software Foundation, Inc. This file is part of GDB. @@ -47,6 +47,7 @@ # 3 is done by function 'handle_notif_ack'. */ +#include "server.h" #include "notif.h" static struct notif_server *notifs[] = @@ -78,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))