From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 6E6EA3858298; Wed, 25 Jan 2023 12:01:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E6EA3858298 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1674648082; bh=NS8S1q0pi5LF/l+dpqFpnTiryI2n7s0bzapHQdFpTlM=; h=From:To:Subject:Date:From; b=Rv7gpwdmQG5SMwEuOY59a4PMut56sfs5l7/lRLwYXA+PpgU5F+YGs0NtdR+sXX8yw QYMQy2uNylZ7BY2l06erHYMGhwGUCLGLQYy1Vi0CIsVD8ZXB8fG63tf+2ReJ0hKmJq ciSXqbesCNYxOT4Q1DobZEGEMH6lrxsMv3JhHj4Q= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/tui: make use of a scoped_restore X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 6db98f026e4dcd7ca9d069542a7bbb3f4539482b X-Git-Newrev: 2e10cefd83b6a5b0b3745da1134d35a4924db6c5 Message-Id: <20230125120122.6E6EA3858298@sourceware.org> Date: Wed, 25 Jan 2023 12:01:22 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2e10cefd83b6= a5b0b3745da1134d35a4924db6c5 commit 2e10cefd83b6a5b0b3745da1134d35a4924db6c5 Author: Andrew Burgess Date: Thu Jan 5 15:13:54 2023 +0000 gdb/tui: make use of a scoped_restore =20 Make use of a scoped_restore object in tui_mld_read_key instead of doing a manual save/restore. =20 I don't think the existing code can throw an exception, so this is just a cleanup rather than a bug fix. =20 There should be no user visible changes after this commit. Diff: --- gdb/tui/tui-io.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c index 2f39e34df2f..a17cf38a1f2 100644 --- a/gdb/tui/tui-io.c +++ b/gdb/tui/tui-io.c @@ -773,14 +773,10 @@ tui_mld_getc (FILE *fp) static int tui_mld_read_key (const struct match_list_displayer *displayer) { - rl_getc_func_t *prev =3D rl_getc_function; - int c; - /* We can't use tui_getc as we need NEWLINE to not get emitted. */ - rl_getc_function =3D tui_mld_getc; - c =3D rl_read_key (); - rl_getc_function =3D prev; - return c; + scoped_restore restore_getc_function + =3D make_scoped_restore (&rl_getc_function, tui_mld_getc); + return rl_read_key (); } =20 /* TUI version of rl_completion_display_matches_hook.