[Spice-devel] [PATCH] Cache field to make code easier

Victor Toso lists at victortoso.com
Fri Sep 30 11:55:49 UTC 2016


Hi,

On Thu, Sep 29, 2016 at 09:46:04AM +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

why not? :)
Acked-by: Victor Toso <victortoso at redhat.com>

> ---
>  server/display-channel.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/server/display-channel.c b/server/display-channel.c
> index d7ea7d5..32f8e67 100644
> --- a/server/display-channel.c
> +++ b/server/display-channel.c
> @@ -1976,22 +1976,23 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
>  
>      switch (surface_cmd->type) {
>      case QXL_SURFACE_CMD_CREATE: {
> -        uint32_t height = surface_cmd->u.surface_create.height;
> -        int32_t stride = surface_cmd->u.surface_create.stride;
> +        const RedSurfaceCreate *create = &surface_cmd->u.surface_create;
> +        uint32_t height = create->height;
> +        int32_t stride = create->stride;
>          int reloaded_surface = loadvm || (surface_cmd->flags & QXL_SURF_FLAG_KEEP_DATA);
>  
>          if (surface->refs) {
>              spice_warning("avoiding creating a surface twice");
>              break;
>          }
> -        data = surface_cmd->u.surface_create.data;
> +        data = create->data;
>          if (stride < 0) {
>              /* No need to worry about overflow here, command should already be validated
>               * when it is read, specifically red_get_surface_cmd */
>              data -= (int32_t)(stride * (height - 1));
>          }
> -        display_channel_create_surface(display, surface_id, surface_cmd->u.surface_create.width,
> -                                       height, stride, surface_cmd->u.surface_create.format, data,
> +        display_channel_create_surface(display, surface_id, create->width,
> +                                       height, stride, create->format, data,
>                                         reloaded_surface,
>                                         // reloaded surfaces will be sent on demand
>                                         !reloaded_surface);
> -- 
> 2.7.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20160930/5f2f4ab4/attachment.sig>


More information about the Spice-devel mailing list