mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-06 12:09:26 +08:00
Use scoped_restore in safe_parse_type
This changes safe_parse_type to use scoped_restore rather than explicit assignments.
This commit is contained in:
parent
d9f9581186
commit
c3d4b6a6d9
@ -3168,12 +3168,11 @@ check_typedef (struct type *type)
|
||||
static struct type *
|
||||
safe_parse_type (struct gdbarch *gdbarch, const char *p, int length)
|
||||
{
|
||||
struct ui_file *saved_gdb_stderr;
|
||||
struct type *type = NULL; /* Initialize to keep gcc happy. */
|
||||
|
||||
/* Suppress error messages. */
|
||||
saved_gdb_stderr = gdb_stderr;
|
||||
gdb_stderr = &null_stream;
|
||||
scoped_restore saved_gdb_stderr = make_scoped_restore (&gdb_stderr,
|
||||
&null_stream);
|
||||
|
||||
/* Call parse_and_eval_type() without fear of longjmp()s. */
|
||||
try
|
||||
@ -3185,9 +3184,6 @@ safe_parse_type (struct gdbarch *gdbarch, const char *p, int length)
|
||||
type = builtin_type (gdbarch)->builtin_void;
|
||||
}
|
||||
|
||||
/* Stop suppressing error messages. */
|
||||
gdb_stderr = saved_gdb_stderr;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user