This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Cleanup num_found usage in gdb_wait_for_event
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>
- Date: Wed, 29 Apr 2015 14:19:29 -0400
- Subject: [PATCH] Cleanup num_found usage in gdb_wait_for_event
- Authentication-results: sourceware.org; auth=none
Probably an artifact from the past, managing num_found in those loops is
not need.
Regtested on Ubuntu 14.04 x64, although only with use_poll == 1.
gdb/ChangeLog:
* event-loop.c (gdb_wait_for_event): Cleanup uneeded usages of
num_found.
---
gdb/event-loop.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 79e41fd..c7ad8b8 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -751,24 +751,22 @@ gdb_wait_for_event (int block)
if (use_poll)
{
#ifdef HAVE_POLL
- for (i = 0; (i < gdb_notifier.num_fds) && (num_found > 0); i++)
+ for (i = 0; i < gdb_notifier.num_fds; i++)
{
- if ((gdb_notifier.poll_fds + i)->revents)
- num_found--;
- else
+ if (!gdb_notifier.poll_fds[i].revents)
continue;
for (file_ptr = gdb_notifier.first_file_handler;
file_ptr != NULL;
file_ptr = file_ptr->next_file)
{
- if (file_ptr->fd == (gdb_notifier.poll_fds + i)->fd)
+ if (file_ptr->fd == gdb_notifier.poll_fds[i].fd)
break;
}
if (file_ptr)
{
- int mask = (gdb_notifier.poll_fds + i)->revents;
+ int mask = gdb_notifier.poll_fds[i].revents;
handle_file_event (file_ptr, mask);
return 1;
@@ -782,7 +780,7 @@ gdb_wait_for_event (int block)
else
{
for (file_ptr = gdb_notifier.first_file_handler;
- (file_ptr != NULL) && (num_found > 0);
+ file_ptr != NULL;
file_ptr = file_ptr->next_file)
{
int mask = 0;
@@ -796,8 +794,6 @@ gdb_wait_for_event (int block)
if (!mask)
continue;
- else
- num_found--;
handle_file_event (file_ptr, mask);
return 1;
--
2.1.4