Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Cleanup num_found usage in gdb_wait_for_event
@ 2015-04-29 19:16 Simon Marchi
  2015-04-29 20:43 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2015-04-29 19:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-15 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-29 19:16 [PATCH] Cleanup num_found usage in gdb_wait_for_event Simon Marchi
2015-04-29 20:43 ` Pedro Alves
2015-04-29 22:44   ` Simon Marchi
2015-05-06 17:46     ` [PATCH] Fix gdb.mi/mi-nsmoribund.exp timeouts (Re: [PATCH] Cleanup num_found usage in gdb_wait_for_event) Pedro Alves
2015-05-15 15:33       ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox