This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 03/16] Add new_remote_state
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 01 Jul 2013 17:05:45 +0100
- Subject: Re: [PATCH 03/16] Add new_remote_state
- References: <1372441229-305-1-git-send-email-tromey at redhat dot com> <1372441229-305-4-git-send-email-tromey at redhat dot com>
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