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)

Tom Tromey
2012-09-28T20:07:33Z

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