From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwVT4-0002Qc-A1 for qemu-devel@nongnu.org; Wed, 11 Nov 2015 08:29:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwVT3-0001tI-7i for qemu-devel@nongnu.org; Wed, 11 Nov 2015 08:29:42 -0500 References: <1447224690-9743-1-git-send-email-eblake@redhat.com> <1447224690-9743-20-git-send-email-eblake@redhat.com> From: =?UTF-8?Q?Andreas_F=c3=a4rber?= Message-ID: <564342B8.60103@suse.de> Date: Wed, 11 Nov 2015 14:29:28 +0100 MIME-Version: 1.0 In-Reply-To: <1447224690-9743-20-git-send-email-eblake@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v11 19/28] qapi: Change munging of CamelCase enum values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: Kevin Wolf , Peter Maydell , Michael Roth , qemu-block , "Michael S. Tsirkin" , Jason Wang , armbru@redhat.com, Luiz Capitulino , Gerd Hoffmann , Amit Shah Am 11.11.2015 um 07:51 schrieb Eric Blake: > When munging enum values, the fact that we were passing the entire > prefix + value through camel_to_upper() meant that enum values > spelled with CamelCase could be turned into CAMEL_CASE. However, > this provides a potential collision (both OneTwo and One-Two would > munge into ONE_TWO). By changing the generation of enum constants > to always be prefix + '_' + c_name(value).upper(), we can avoid > any risk of collisions (if we can also ensure no case collisions, > in the next patch) without having to think about what the > heuristics in camel_to_upper() will actually do to the value. >=20 > Thankfully, only two enums are affected: ErrorClass and InputButton. >=20 > Suggested by: Markus Armbruster > Signed-off-by: Eric Blake [...] > diff --git a/qdev-monitor.c b/qdev-monitor.c > index a35098f..1c39432 100644 > --- a/qdev-monitor.c > +++ b/qdev-monitor.c > @@ -461,7 +461,7 @@ static BusState *qbus_find(const char *path, Error = **errp) > pos +=3D len; > dev =3D qbus_find_dev(bus, elem); > if (!dev) { > - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, > + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, > "Device '%s' not found", elem); > qbus_list_dev(bus, errp); > return NULL; > @@ -788,7 +788,7 @@ void qmp_device_del(const char *id, Error **errp) > } >=20 > if (!obj) { > - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, > + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, > "Device '%s' not found", id); > return; > } [...] > diff --git a/qom/object.c b/qom/object.c > index c0decb6..425b7c3 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -1018,7 +1018,7 @@ Object *object_property_get_link(Object *obj, con= st char *name, > if (str && *str) { > target =3D object_resolve_path(str, NULL); > if (!target) { > - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, > + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, > "Device '%s' not found", str); > } > } > @@ -1337,7 +1337,7 @@ static Object *object_resolve_link(Object *obj, c= onst char *name, > if (target || ambiguous) { > error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, target= _type); > } else { > - error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, > + error_set(errp, ERROR_CLASS_DEVICENOTFOUND, > "Device '%s' not found", path); > } > target =3D NULL; That spelling is not exactly an improvement, but well, Reviewed-by: Andreas F=E4rber Regards, Andreas --=20 SUSE Linux GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Felix Imend=F6rffer, Jane Smithard, Graham Norton; HRB 21284 (AG N=FC= rnberg)