From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21900 invoked by alias); 29 Apr 2015 18:19:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 21886 invoked by uid 89); 29 Apr 2015 18:19:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 29 Apr 2015 18:19:36 +0000 Received: from EUSAAHC008.ericsson.se (Unknown_Domain [147.117.188.96]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id 8C.10.06409.6FCB0455; Wed, 29 Apr 2015 13:13:58 +0200 (CEST) Received: from elxcz23q12-y4.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.96) with Microsoft SMTP Server (TLS) id 14.3.210.2; Wed, 29 Apr 2015 14:19:32 -0400 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH] Cleanup num_found usage in gdb_wait_for_event Date: Wed, 29 Apr 2015 19:16:00 -0000 Message-ID: <1430331569-17144-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01082.txt.bz2 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