[Spice-devel] [PATCH spice-common RFC] Fix linearization of several marshallers with one item

Christophe Fergeau cfergeau at redhat.com
Fri Jul 31 02:11:54 PDT 2015


Hey,

On Mon, Jul 27, 2015 at 01:27:14PM +0200, Javier Celaya wrote:
> The linearization optimization that avoids copying only one item must
> check that there are no further marshallers in the chain.
> ---
>  common/marshaller.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/marshaller.c b/common/marshaller.c
> index bd012d7..0c6680e 100644
> --- a/common/marshaller.c
> +++ b/common/marshaller.c
> @@ -419,7 +419,7 @@ uint8_t *spice_marshaller_linearize(SpiceMarshaller *m, size_t skip_bytes,
>      /* Only supported for root marshaller */
>      assert(m->data->marshallers == m);
>  
> -    if (m->n_items == 1) {
> +    if (m->n_items == 1 && m->next == NULL) {
>          *free_res = FALSE;
>          if (m->items[0].len <= skip_bytes) {
>              *len = 0;

Yes, this makes a lot of sense, though your follow-up explanation should
be in the commit log. Thanks for tracking this down, ACK.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150731/a080954e/attachment.sig>


More information about the Spice-devel mailing list