[Spice-devel] [PATCH] Simplify pointer computation

Christophe Fergeau cfergeau at redhat.com
Fri Oct 9 09:33:18 PDT 2015


On Wed, Oct 07, 2015 at 12:25:40PM +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/reds_stream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/reds_stream.c b/server/reds_stream.c
> index 1a595b2..6dc41ca 100644
> --- a/server/reds_stream.c
> +++ b/server/reds_stream.c
> @@ -326,7 +326,7 @@ RedsStream *reds_stream_new(int socket)
>      RedsStream *stream;
>  
>      stream = spice_malloc0(sizeof(RedsStream) + sizeof(RedsStreamPrivate));
> -    stream->priv = (RedsStreamPrivate *)(((char *)stream) + sizeof(RedsStream));
> +    stream->priv = (RedsStreamPrivate *)(stream+1);

Why not, not sure I'd consider it simpler, but ACK.

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


More information about the Spice-devel mailing list