+2016-11-30 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * mi/mi-out.c: Remove vec.h include.
+ (mi_ui_out_data) <streams>: Change type to std::vector.
+ (mi_field_string): Update.
+ (mi_field_fmt): Update.
+ (mi_flush): Update.
+ (mi_redirect): Update.
+ (field_separator): Update.
+ (mi_open): Update.
+ (mi_close): Update.
+ (mi_out_buffered): Update.
+ (mi_out_rewind): Update.
+ (mi_out_put): Update.
+ (mi_out_data_ctor): Update.
+ (mi_out_data_dtor): Don't free streams.
+
2016-11-30 Simon Marchi <simon.marchi@polymtl.ca>
* ui-out.c (ui_out_level_p): Remove typedef.
#include "defs.h"
#include "ui-out.h"
#include "mi-out.h"
-#include "vec.h"
-
-typedef struct ui_file *ui_filep;
-DEF_VEC_P (ui_filep);
+#include <vector>
struct mi_ui_out_data
{
int suppress_field_separator;
int suppress_output;
int mi_version;
- VEC (ui_filep) *streams;
+ std::vector<ui_file *> streams;
};
typedef struct mi_ui_out_data mi_out_data;
if (data->suppress_output)
return;
- stream = VEC_last (ui_filep, data->streams);
+ stream = data->streams.back ();
field_separator (uiout);
if (fldname)
fprintf_unfiltered (stream, "%s=", fldname);
if (data->suppress_output)
return;
- stream = VEC_last (ui_filep, data->streams);
+ stream = data->streams.back ();
field_separator (uiout);
if (fldname)
fprintf_unfiltered (stream, "%s=\"", fldname);
mi_flush (struct ui_out *uiout)
{
mi_out_data *data = (mi_out_data *) ui_out_data (uiout);
- struct ui_file *stream = VEC_last (ui_filep, data->streams);
+ struct ui_file *stream = data->streams.back ();
gdb_flush (stream);
}
mi_out_data *data = (mi_out_data *) ui_out_data (uiout);
if (outstream != NULL)
- VEC_safe_push (ui_filep, data->streams, outstream);
+ data->streams.push_back (outstream);
else
- VEC_pop (ui_filep, data->streams);
+ data->streams.pop_back ();
return 0;
}
field_separator (struct ui_out *uiout)
{
mi_out_data *data = (mi_out_data *) ui_out_data (uiout);
- struct ui_file *stream = VEC_last (ui_filep, data->streams);
+ ui_file *stream = data->streams.back ();
if (data->suppress_field_separator)
data->suppress_field_separator = 0;
mi_open (struct ui_out *uiout, const char *name, enum ui_out_type type)
{
mi_out_data *data = (mi_out_data *) ui_out_data (uiout);
- struct ui_file *stream = VEC_last (ui_filep, data->streams);
+ ui_file *stream = data->streams.back ();
field_separator (uiout);
data->suppress_field_separator = 1;
mi_close (struct ui_out *uiout, enum ui_out_type type)
{
mi_out_data *data = (mi_out_data *) ui_out_data (uiout);
- struct ui_file *stream = VEC_last (ui_filep, data->streams);
+ ui_file *stream = data->streams.back ();
switch (type)
{
mi_out_rewind (struct ui_out *uiout)
{
mi_out_data *data = (mi_out_data *) ui_out_data (uiout);
- struct ui_file *stream = VEC_last (ui_filep, data->streams);
+ ui_file *stream = data->streams.back ();
ui_file_rewind (stream);
}
mi_out_put (struct ui_out *uiout, struct ui_file *stream)
{
mi_out_data *data = (mi_out_data *) ui_out_data (uiout);
- struct ui_file *outstream = VEC_last (ui_filep, data->streams);
+ ui_file *outstream = data->streams.back ();
ui_file_put (outstream, ui_file_write_for_put, stream);
ui_file_rewind (outstream);
{
gdb_assert (stream != NULL);
- self->streams = NULL;
- VEC_safe_push (ui_filep, self->streams, stream);
+ self->streams.push_back (stream);
self->suppress_field_separator = 0;
self->suppress_output = 0;
{
mi_out_data *data = (mi_out_data *) ui_out_data (ui_out);
- VEC_free (ui_filep, data->streams);
delete data;
}