From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zpdhw-0005Ae-UI for qemu-devel@nongnu.org; Fri, 23 Oct 2015 10:52:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zpdhr-0003fQ-Pt for qemu-devel@nongnu.org; Fri, 23 Oct 2015 10:52:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33974) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zpdhr-0003f4-K7 for qemu-devel@nongnu.org; Fri, 23 Oct 2015 10:52:35 -0400 References: <1445576998-2921-1-git-send-email-eblake@redhat.com> <1445576998-2921-6-git-send-email-eblake@redhat.com> <87d1w5hh1e.fsf@blackfin.pond.sub.org> <562A40D1.30600@redhat.com> <87ziz9bq0v.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <562A49AD.1000100@redhat.com> Date: Fri, 23 Oct 2015 08:52:29 -0600 MIME-Version: 1.0 In-Reply-To: <87ziz9bq0v.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IRhmSiFDm6m3CNoB31EuH7wM8Mu24JhSv" Subject: Re: [Qemu-devel] [PATCH v10 05/25] qapi: Reserve 'q_*' and 'has_*' member names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --IRhmSiFDm6m3CNoB31EuH7wM8Mu24JhSv Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/23/2015 08:47 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> On 10/23/2015 07:05 AM, Markus Armbruster wrote: >>> Eric Blake 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 t= he >> approach you see here) >=20 > c_name(membername, False).startswith('q_')? Oh, I forgot about the optional bool. I'll try it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --IRhmSiFDm6m3CNoB31EuH7wM8Mu24JhSv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWKkmtAAoJEKeha0olJ0Nqsf4H/RX/a0DPdqgWchfyLSpN9tV1 wDEO4kt6IU2DIOYKksM5usvnzT5/wFSk4hWZ8Sek1ijnMpAjKRANGBeEvjp34/C3 zC47HcNAXufAeI1s1ujhYzhkwH4v7qh5FZPM1YeoJ/iwfikz2daTezrLLsUfM3Ic QnPTya6pa6jg+8hthcmSNiP8WbxNu9tlUFKSx9LyKRxrK7BDYZzy4ev5ckzUDvm1 njc5C0tQw5maAZ6xoCWJrtKL9MUCF5dVYbYKZHo1lDK75G7oQuOuMw0NlYmlfigt Y1LYusNyJ+/xLjn2iUt93CHGLpmY6bqTQc1LxFp1fKE3iYcPGTnTwL4dm4l4fNY= =+23Q -----END PGP SIGNATURE----- --IRhmSiFDm6m3CNoB31EuH7wM8Mu24JhSv--