[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH] memory: give name every AddressSpace
From: |
David Gibson |
Subject: |
Re: [Qemu-trivial] [PATCH] memory: give name every AddressSpace |
Date: |
Mon, 29 Apr 2013 21:09:54 +1000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Apr 29, 2013 at 11:25:16AM +0200, Paolo Bonzini wrote:
> Il 29/04/2013 10:21, Alexey Kardashevskiy ha scritto:
> >>> >> + g_free((void *)as->name);
> >> >
> >> > No cast here.
> > ?
> >
> > CC ppc64-softmmu/memory.o
> > /home/alexey/pcipassthru/qemu-impreza/memory.c: In function
> > 'address_space_destroy':
> > /home/alexey/pcipassthru/qemu-impreza/memory.c:1626:5: warning: passing
> > argument 1 of 'g_free' discards 'const' qualifier from pointer target type
> > [enabled by default]
> > g_free(/*(void *)*/as->name);
> > ^
>
> Please remove the const from as->name instead. Since you are strdup-ing
> it, and the field is meant to be private to memory.c anyway, you do not
> need protection against changing it.
As a general rule, pointer variables that you malloc()ate should not
be const.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: Digital signature