aboutsummaryrefslogtreecommitdiff
path: root/gdb/ui-out.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-05-10 21:30:37 +0000
committerAndrew Cagney <cagney@redhat.com>2001-05-10 21:30:37 +0000
commit127431f9a7b56cb6b4daf8887cca8ff48064fa40 (patch)
treec1549369d088188d094b5350183085b1e386c754 /gdb/ui-out.c
parent5dbc5e5f2541c46861dc2ce3d13ea15c0a5bdc45 (diff)
downloadgdb-127431f9a7b56cb6b4daf8887cca8ff48064fa40.zip
gdb-127431f9a7b56cb6b4daf8887cca8ff48064fa40.tar.gz
gdb-127431f9a7b56cb6b4daf8887cca8ff48064fa40.tar.bz2
2001-05-10 Andrew Cagney <ac131313@redhat.com>
* ui-out.h (make_cleanup_ui_out_begin_end): Declare. * ui-out.c (struct ui_out_end_cleanup_data): Define. (do_cleanup_end): New function. Replace do_list_end. (make_cleanup_ui_out_end): New function. (make_cleanup_ui_out_begin_end): New function. (make_cleanup_ui_out_list_end): Use make_cleanup_ui_out_end.
Diffstat (limited to 'gdb/ui-out.c')
-rw-r--r--gdb/ui-out.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/gdb/ui-out.c b/gdb/ui-out.c
index 696128d..3e0f55c 100644
--- a/gdb/ui-out.c
+++ b/gdb/ui-out.c
@@ -352,16 +352,44 @@ ui_out_list_end (struct ui_out *uiout)
ui_out_end (uiout, ui_out_type_list);
}
+struct ui_out_end_cleanup_data
+{
+ struct ui_out *uiout;
+ enum ui_out_type type;
+};
+
static void
-do_list_end (void *uiout)
+do_cleanup_end (void *data)
+{
+ struct ui_out_end_cleanup_data *end_cleanup_data = data;
+ ui_out_end (end_cleanup_data->uiout, end_cleanup_data->type);
+ xfree (end_cleanup_data);
+}
+
+static struct cleanup *
+make_cleanup_ui_out_end (struct ui_out *uiout,
+ enum ui_out_type type)
+{
+ struct ui_out_end_cleanup_data *end_cleanup_data;
+ end_cleanup_data = XMALLOC (struct ui_out_end_cleanup_data);
+ end_cleanup_data->uiout = uiout;
+ end_cleanup_data->type = type;
+ return make_cleanup (do_cleanup_end, end_cleanup_data);
+}
+
+struct cleanup *
+make_cleanup_ui_out_begin_end (struct ui_out *uiout,
+ enum ui_out_type type,
+ const char *id)
{
- ui_out_list_end (uiout);
+ ui_out_begin (uiout, type, id);
+ return make_cleanup_ui_out_end (uiout, type);
}
struct cleanup *
make_cleanup_ui_out_list_end (struct ui_out *uiout)
{
- return make_cleanup (do_list_end, uiout);
+ return make_cleanup_ui_out_end (uiout, ui_out_type_list);
}
void