[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V2 2/8] qapi script: add check for duplicated ke
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH V2 2/8] qapi script: add check for duplicated key |
Date: |
Mon, 02 Dec 2013 12:42:21 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
On 11/12/2013 03:25 PM, Wenchao Xia wrote:
> It is bad that same key was specified twice, especially when a union have
> two branches with same condition. This patch can prevent it.
>
> Signed-off-by: Wenchao Xia <address@hidden>
> ---
> scripts/qapi.py | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index 82f586e..aa91edc 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -116,6 +116,8 @@ class QAPISchema:
> if self.tok != ':':
> raise QAPISchemaError(self, 'Expected ":"')
> self.accept()
> + if key in expr:
> + raise QAPISchemaError(self, 'Duplicated key "%s"' % key)
> expr[key] = self.get_expr(True)
> if self.tok == '}':
> self.accept()
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH V2 2/8] qapi script: add check for duplicated key,
Eric Blake <=