Re: [PATCH 03/16] Add new_remote_state

Pedro Alves
2013-07-01T16:05:48Z

On 06/28/2013 06:40 PM, Tom Tromey wrote:
> +/* Allocate a new struct remote_state with xmalloc, initialize it, and
> + return it. */
> +
> +static struct remote_state *
> +new_remote_state (void)
> +{
> + struct remote_state *result = XCNEW (struct remote_state);
> +
> + result->buf_size = 400;
> + result->buf = xmalloc (result->buf_size);

I was re-reading this, and wondering "hmm, wait, where does that 400
come from?"

...

> /* Description of the remote protocol for a given architecture. */
> @@ -11800,9 +11814,7 @@ _initialize_remote (void)
> of these, not one per target. Only one target is active at a
> time. The default buffer size is unimportant; it will be expanded
> whenever a larger buffer is needed. */

... then I notice this "The default buffer ..." comment. I think it'd be
good move it too.

Sorry for missing this one the first time around.

> - rs = get_remote_state_raw ();
> - rs->buf_size = 400;
> - rs->buf = xmalloc (rs->buf_size);
> + remote_state = new_remote_state ();
--
Pedro Alves