aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2023-01-05 15:13:54 +0000
committerAndrew Burgess <aburgess@redhat.com>2023-01-25 11:35:02 +0000
commit2e10cefd83b6a5b0b3745da1134d35a4924db6c5 (patch)
treebb02f8ed4aa41ed997f43c9950add4529e0b39ce
parent6db98f026e4dcd7ca9d069542a7bbb3f4539482b (diff)
downloadgdb-2e10cefd83b6a5b0b3745da1134d35a4924db6c5.zip
gdb-2e10cefd83b6a5b0b3745da1134d35a4924db6c5.tar.gz
gdb-2e10cefd83b6a5b0b3745da1134d35a4924db6c5.tar.bz2
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.
-rw-r--r--gdb/tui/tui-io.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 2f39e34..a17cf38 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.