Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@ericsson.com>
To: <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@ericsson.com>
Subject: [PATCH] Cleanup num_found usage in gdb_wait_for_event
Date: Wed, 29 Apr 2015 19:16:00 -0000	[thread overview]
Message-ID: <1430331569-17144-1-git-send-email-simon.marchi@ericsson.com> (raw)

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


             reply	other threads:[~2015-04-29 18:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29 19:16 Simon Marchi [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430331569-17144-1-git-send-email-simon.marchi@ericsson.com \
    --to=simon.marchi@ericsson.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox