[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 2/3] qapi: add const prefix to 'char *' insid
From: |
Amos Kong |
Subject: |
Re: [Qemu-devel] [PATCH v6 2/3] qapi: add const prefix to 'char *' insider c_type() |
Date: |
Wed, 18 Jun 2014 15:54:21 +0800 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Tue, Jun 17, 2014 at 09:51:21PM -0600, Eric Blake wrote:
> On 06/10/2014 05:25 AM, Amos Kong wrote:
> > It's ugly to add const prefix for parameter type by an if statement
> > outside c_type(). This patch adds a parameter to do it.
> >
> > Signed-off-by: Amos Kong <address@hidden>
> > Suggested-by: Markus Armbruster <address@hidden>
> > Reviewed-by: Eric Blake <address@hidden>
> > Reviewed-by: Paolo Bonzini <address@hidden>
> > Reviewed-by: Markus Armbruster <address@hidden>
> > ---
> > scripts/qapi-commands.py | 4 +---
> > scripts/qapi.py | 4 +++-
> > 2 files changed, 4 insertions(+), 4 deletions(-)
>
> Wenchao's series introduces another client that needs this treatment:
> https://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01225.html
>
> Depending on what order things get merged in, you may need followup
> patches or conflict resolution.
Thanks for the reminder.
I just checked the patch, c_type() is only used once, and the output
is used insider mcgen().
So it's safe to apply my patchset.
> > diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
> > index 7d93d01..34f200a 100644
> > --- a/scripts/qapi-commands.py
> > +++ b/scripts/qapi-commands.py
> > @@ -29,9 +29,7 @@ def type_visitor(name):
> > def generate_command_decl(name, args, ret_type):
> > arglist=""
> > for argname, argtype, optional, structured in parse_args(args):
> > - argtype = c_type(argtype)
> > - if argtype == "char *":
> > - argtype = "const char *"
> > + argtype = c_type(argtype, is_param=True)
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
--
Amos.
pgpifIPasBDGj.pgp
Description: PGP signature