[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v10 05/25] qapi: Reserve 'q_*' and 'has_*' membe
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v10 05/25] qapi: Reserve 'q_*' and 'has_*' member names |
Date: |
Fri, 23 Oct 2015 08:52:29 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 10/23/2015 08:47 AM, Markus Armbruster wrote:
> Eric Blake <address@hidden> writes:
>
>> On 10/23/2015 07:05 AM, Markus Armbruster wrote:
>>> Eric Blake <address@hidden> writes:
>>>
>>>> c_name() produces names starting with 'q_' when protecting
>>>> a QMP member name that would fail to directly compile, but
>>>> in doing so can cause clashes with any QMP name already
>>>> beginning with 'q-' or 'q_'. Likewise, we create a C name
>>>> 'has_' for any optional member, that can clash with any QMP
>>>> name beginning with 'has-' or 'has_'.
>>>>
>>>> - if not valid_name.match(membername):
>>>> + # Reserve the entire 'q_' namespace for c_name()
>>>> + if not valid_name.match(membername) or \
>>>> + membername.replace('-', '_').startswith('q_'):
>>>
>>> Why not c_name(membername).startswith('q_')?
>>
>> Recursion. c_name('unix') is 'q_unix', which would be rejected, even
>> though we want to accept it. (And yes, that was my first try, before the
>> approach you see here)
>
> c_name(membername, False).startswith('q_')?
Oh, I forgot about the optional bool. I'll try it.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
[Qemu-devel] [PATCH v10 02/25] qapi: More idiomatic string operations, Eric Blake, 2015/10/23
[Qemu-devel] [PATCH v10 03/25] qapi: More robust conditions for when labels are needed, Eric Blake, 2015/10/23
[Qemu-devel] [PATCH v10 06/25] vnc: Hoist allocation of VncBasicInfo to callers, Eric Blake, 2015/10/23
[Qemu-devel] [PATCH v10 08/25] qapi-types: Refactor base fields output, Eric Blake, 2015/10/23
[Qemu-devel] [PATCH v10 01/25] tests/qapi-schema: Test for reserved names, empty struct, Eric Blake, 2015/10/23