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] 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


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