public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/tui: make use of a scoped_restore Date: Wed, 25 Jan 2023 12:01:22 +0000 (GMT) [thread overview] Message-ID: <20230125120122.6E6EA3858298@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2e10cefd83b6a5b0b3745da1134d35a4924db6c5 commit 2e10cefd83b6a5b0b3745da1134d35a4924db6c5 Author: Andrew Burgess <aburgess@redhat.com> Date: Thu Jan 5 15:13:54 2023 +0000 gdb/tui: make use of a scoped_restore Make use of a scoped_restore object in tui_mld_read_key instead of doing a manual save/restore. I don't think the existing code can throw an exception, so this is just a cleanup rather than a bug fix. 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 = rl_getc_function; - int c; - /* We can't use tui_getc as we need NEWLINE to not get emitted. */ - rl_getc_function = tui_mld_getc; - c = rl_read_key (); - rl_getc_function = prev; - return c; + scoped_restore restore_getc_function + = make_scoped_restore (&rl_getc_function, tui_mld_getc); + return rl_read_key (); } /* TUI version of rl_completion_display_matches_hook.
reply other threads:[~2023-01-25 12:01 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230125120122.6E6EA3858298@sourceware.org \ --to=aburgess@sourceware.org \ --cc=gdb-cvs@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: linkBe 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; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).