[Spice-devel] [PATCH 2/5] qxl parser: add cursor parsing

Alexander Larsson alexl at redhat.com
Thu Aug 26 23:38:15 PDT 2010


On Fri, 2010-08-27 at 00:09 +0200, Gerd Hoffmann wrote:
> 
> +    red->data_size = qxl->data_size;
> +    size = red_get_data_chunks_ptr(slots, group_id,
> +                                   get_memslot_id(slots, addr),
> +                                   &chunks, &qxl->chunk);
> +    data = red_linearize_chunk(&chunks, size, &free_data);
> +    red_put_data_chunks(&chunks);
> +    red->data = spice_malloc(size);
> +    memcpy(red->data, data, size);
> +
> +    if (free_data) {
> +        free(data);
> +    } 

Ack, but this part could be more efficient. In the n_chunks > 1 case the
red_linearize_chunk part will already malloc and copy the data so we
don't need to do it then. We should have a linearlize_chunks variant
that always copies and use that.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Alexander Larsson                                            Red Hat, Inc 
       alexl at redhat.com            alexander.larsson at gmail.com 
He's a time-tossed flyboy boxer with a winning smile and a way with the 
ladies. She's a wealthy junkie advertising executive from aristocratic 
European stock. They fight crime! 



More information about the Spice-devel mailing list