This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 11/22] Use std::vector for cli_ui_out_data::streams


On 11/24/2016 03:26 PM, Simon Marchi wrote:
> @@ -406,13 +404,14 @@ cli_out_set_stream (struct ui_out *uiout, struct ui_file *stream)
>  {
>    cli_out_data *data = (cli_out_data *) ui_out_data (uiout);
>    struct ui_file *old;
> -  
> -  old = VEC_pop (ui_filep, data->streams);
> -  VEC_quick_push (ui_filep, data->streams, stream);
> +
> +  old = data->streams.back ();
> +  data->streams.pop_back ();
> +  data->streams.push_back (stream);

back() returns a reference, so this pop/push can be just:

     data->streams.back () = stream;

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]