[PATCH 03/16] Add new_remote_state

Pedro Alves palves@redhat.com
Mon Jul 1 16:05:00 GMT 2013


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



More information about the Gdb-patches mailing list