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 v2 12/19] read/write_pieced_value: Drop 'buffer_size' variable


Andreas Arnez <arnez@linux.vnet.ibm.com> writes:

Patch is good to me, a nit below,

> @@ -1806,12 +1805,8 @@ read_pieced_value (struct value *v)
>  	this_size_bits = max_offset - offset;
>  
>        this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
> +      buffer.reserve (this_size);

I noticed that buffer is only used within the for loop, so probably we
can move it into the loop, and do "std::vector<gdb_byte> buffer (this_size);"

This change makes troubles for you to rebase your following patches, so
if you want to change it, you can do it in another patch, 20/19, for
example.

>        source_offset = source_offset_bits / 8;
> -      if (buffer_size < this_size)
> -	{
> -	  buffer_size = this_size;
> -	  buffer.reserve (buffer_size);
> -	}
>        intermediate_buffer = buffer.data ();
>  
>        /* Copy from the source to DEST_BUFFER.  */

-- 
Yao (齐尧)


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