X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Futils.c;h=3dc2f03d61dd0e02aa16685f77dc048e1b00ff55;hb=b761ca9e3d6e9c0f1762e0994dfdf2b989e3fc21;hp=3a88e2a97162bc3c14fe88ee6617d6cbc4253b46;hpb=d2c0eef48a1bb331ca08f8f26ff82c5d4086ba0c;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/utils.c b/gdb/utils.c index 3a88e2a971..3dc2f03d61 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1,6 +1,6 @@ /* General utility routines for GDB, the GNU debugger. - Copyright (C) 1986-2016 Free Software Foundation, Inc. + Copyright (C) 1986-2017 Free Software Foundation, Inc. This file is part of GDB. @@ -151,18 +151,6 @@ make_cleanup_freeargv (char **arg) return make_cleanup (do_freeargv, arg); } -static void -do_bfd_close_cleanup (void *arg) -{ - gdb_bfd_unref ((bfd *) arg); -} - -struct cleanup * -make_cleanup_bfd_unref (bfd *abfd) -{ - return make_cleanup (do_bfd_close_cleanup, abfd); -} - /* Helper function which does the work for make_cleanup_fclose. */ static void @@ -199,18 +187,6 @@ make_cleanup_obstack_free (struct obstack *obstack) return make_cleanup (do_obstack_free, obstack); } -static void -do_ui_file_delete (void *arg) -{ - ui_file_delete ((struct ui_file *) arg); -} - -struct cleanup * -make_cleanup_ui_file_delete (struct ui_file *arg) -{ - return make_cleanup (do_ui_file_delete, arg); -} - /* Helper function for make_cleanup_ui_out_redirect_pop. */ static void @@ -218,8 +194,7 @@ do_ui_out_redirect_pop (void *arg) { struct ui_out *uiout = (struct ui_out *) arg; - if (ui_out_redirect (uiout, NULL) < 0) - warning (_("Cannot restore redirection of the current output protocol")); + uiout->redirect (NULL); } /* Return a new cleanup that pops the last redirection by ui_out_redirect @@ -299,24 +274,6 @@ make_cleanup_unpush_target (struct target_ops *ops) return make_cleanup (do_unpush_target, ops); } -/* Helper for make_cleanup_htab_delete compile time checking the types. */ - -static void -do_htab_delete_cleanup (void *htab_voidp) -{ - htab_t htab = (htab_t) htab_voidp; - - htab_delete (htab); -} - -/* Return a new cleanup that deletes HTAB. */ - -struct cleanup * -make_cleanup_htab_delete (htab_t htab) -{ - return make_cleanup (do_htab_delete_cleanup, htab); -} - /* Helper for make_cleanup_value_free_to_mark. */ static void @@ -476,11 +433,9 @@ verror (const char *string, va_list args) } void -error_stream (struct ui_file *stream) +error_stream (const string_file &stream) { - std::string message = ui_file_as_string (stream); - - error (("%s"), message.c_str ()); + error (("%s"), stream.c_str ()); } /* Emit a message and abort. */ @@ -2034,7 +1989,7 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, || batch_flag || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX) || top_level_interpreter () == NULL - || ui_out_is_mi_like_p (interp_ui_out (top_level_interpreter ()))) + || interp_ui_out (top_level_interpreter ())->is_mi_like_p ()) { fputs_unfiltered (linebuffer, stream); return;