From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id EDCC03858D3C; Mon, 16 May 2022 18:58:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDCC03858D3C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Reindent gdbsupport/event-loop.cc:handle_file_event X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 36a5b3705352f228cdd14a7f9d5e85177fad034c X-Git-Newrev: 187075ebbc0cba7b58685c7214028e791b5af844 Message-Id: <20220516185841.EDCC03858D3C@sourceware.org> Date: Mon, 16 May 2022 18:58:41 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2022 18:58:42 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D187075ebbc0c= ba7b58685c7214028e791b5af844 commit 187075ebbc0cba7b58685c7214028e791b5af844 Author: Pedro Alves Date: Mon May 16 12:20:08 2022 +0100 Reindent gdbsupport/event-loop.cc:handle_file_event =20 The handle_file_event function has a few unnecessary {} lexical blocks, presumably because they were originally if blocks, and the conditions were removed, or something along those lines. =20 Remove the unnecessary blocks, and reindent. =20 Change-Id: Iaecbe5c9f4940a80b81dbbc42e51ce506f6aafb2 Diff: --- gdbsupport/event-loop.cc | 104 +++++++++++++++++++++++--------------------= ---- 1 file changed, 50 insertions(+), 54 deletions(-) diff --git a/gdbsupport/event-loop.cc b/gdbsupport/event-loop.cc index 18f57ef8d61..f078c1278a8 100644 --- a/gdbsupport/event-loop.cc +++ b/gdbsupport/event-loop.cc @@ -492,65 +492,61 @@ handle_file_event (file_handler *file_ptr, int ready_= mask) { int mask; =20 + /* See if the desired events (mask) match the received events + (ready_mask). */ + +#ifdef HAVE_POLL + if (use_poll) { - { - /* With poll, the ready_mask could have any of three events - set to 1: POLLHUP, POLLERR, POLLNVAL. These events - cannot be used in the requested event mask (events), but - they can be returned in the return mask (revents). We - need to check for those event too, and add them to the - mask which will be passed to the handler. */ + int error_mask; =20 - /* See if the desired events (mask) match the received - events (ready_mask). */ + /* With poll, the ready_mask could have any of three events set + to 1: POLLHUP, POLLERR, POLLNVAL. These events cannot be + used in the requested event mask (events), but they can be + returned in the return mask (revents). We need to check for + those event too, and add them to the mask which will be + passed to the handler. */ =20 -#ifdef HAVE_POLL - if (use_poll) - { - int error_mask; - - /* POLLHUP means EOF, but can be combined with POLLIN to - signal more data to read. */ - error_mask =3D POLLHUP | POLLERR | POLLNVAL; - mask =3D ready_mask & (file_ptr->mask | error_mask); - - if ((mask & (POLLERR | POLLNVAL)) !=3D 0) - { - /* Work in progress. We may need to tell somebody - what kind of error we had. */ - if (mask & POLLERR) - warning (_("Error detected on fd %d"), file_ptr->fd); - if (mask & POLLNVAL) - warning (_("Invalid or non-`poll'able fd %d"), - file_ptr->fd); - file_ptr->error =3D 1; - } - else - file_ptr->error =3D 0; - } - else -#endif /* HAVE_POLL */ - { - if (ready_mask & GDB_EXCEPTION) - { - warning (_("Exception condition detected on fd %d"), - file_ptr->fd); - file_ptr->error =3D 1; - } - else - file_ptr->error =3D 0; - mask =3D ready_mask & file_ptr->mask; - } + /* POLLHUP means EOF, but can be combined with POLLIN to + signal more data to read. */ + error_mask =3D POLLHUP | POLLERR | POLLNVAL; + mask =3D ready_mask & (file_ptr->mask | error_mask); =20 - /* If there was a match, then call the handler. */ - if (mask !=3D 0) - { - event_loop_ui_debug_printf (file_ptr->is_ui, - "invoking fd file handler `%s`", - file_ptr->name.c_str ()); - file_ptr->proc (file_ptr->error, file_ptr->client_data); - } + if ((mask & (POLLERR | POLLNVAL)) !=3D 0) + { + /* Work in progress. We may need to tell somebody + what kind of error we had. */ + if (mask & POLLERR) + warning (_("Error detected on fd %d"), file_ptr->fd); + if (mask & POLLNVAL) + warning (_("Invalid or non-`poll'able fd %d"), + file_ptr->fd); + file_ptr->error =3D 1; + } + else + file_ptr->error =3D 0; + } + else +#endif /* HAVE_POLL */ + { + if (ready_mask & GDB_EXCEPTION) + { + warning (_("Exception condition detected on fd %d"), + file_ptr->fd); + file_ptr->error =3D 1; } + else + file_ptr->error =3D 0; + mask =3D ready_mask & file_ptr->mask; + } + + /* If there was a match, then call the handler. */ + if (mask !=3D 0) + { + event_loop_ui_debug_printf (file_ptr->is_ui, + "invoking fd file handler `%s`", + file_ptr->name.c_str ()); + file_ptr->proc (file_ptr->error, file_ptr->client_data); } }