[PATCH] enhancement of mi_cmd_data_write_memory_bytes for filling memory regions (was [PATCH] new MI command for pattern filling of memory regions)

Giuseppe MONTALTO giuseppe.montalto@st.com
Mon Oct 1 09:29:00 GMT 2012


New patch attached:
- removed trivial comments
- removed redundant "else if" clause 

Any further feedback is always welcome,
	Giuseppe.

> -----Original Message-----
> From: Tom Tromey [mailto:tromey@redhat.com]
> Sent: Friday, September 28, 2012 10:07 PM
> To: Giuseppe MONTALTO
> Cc: gdb-patches@sourceware.org; Abid, Hafiz
> Subject: Re: [PATCH] enhancement of mi_cmd_data_write_memory_bytes
> for filling memory regions (was [PATCH] new MI command for pattern filling
> of memory regions)
> 
> >>>>> "Giuseppe" == Giuseppe MONTALTO <giuseppe.montalto@st.com>
> writes:
> 
> Giuseppe> the attached patch should fix all the issues.
> 
> Thanks.  Unfortunately I thought of one more little thing.
> 
> Giuseppe> +      remainder = count % len; /* there may be some spare bytes.
> */
> 
> Comment should start with a capital letter.
> Though TBH you could also just remove this comment since I think the
> code is already clear.
> 
> Giuseppe> +      if (remainder > 0) /* copy spare bytes too.  */
> 
> Likewise on both counts.
> 
> Giuseppe> +  else if (len > count)
> Giuseppe> +    {
> Giuseppe> +      /* Pattern is longer than count:
> Giuseppe> +         just copy len bytes.  */
> Giuseppe> +      data = xmalloc (len);
> Giuseppe> +      make_cleanup (xfree, data);
> Giuseppe> +      memcpy (data, databuf, len);
> 
> There's no need to copy the data here.
> Just set data=databuf.
> 
> Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-V.7.patch
Type: application/octet-stream
Size: 5658 bytes
Desc: patch-V.7.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20121001/ff1cca58/attachment.obj>


More information about the Gdb-patches mailing list