From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5yuN-000557-2k for qemu-devel@nongnu.org; Fri, 19 Jun 2015 12:12:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5yuJ-00038k-RL for qemu-devel@nongnu.org; Fri, 19 Jun 2015 12:12:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5yuJ-00038d-M7 for qemu-devel@nongnu.org; Fri, 19 Jun 2015 12:12:43 -0400 Message-ID: <55843F7A.5050404@redhat.com> Date: Fri, 19 Jun 2015 10:12:42 -0600 From: Eric Blake MIME-Version: 1.0 References: <1432739276-10452-1-git-send-email-berrange@redhat.com> <1432739276-10452-8-git-send-email-berrange@redhat.com> In-Reply-To: <1432739276-10452-8-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BHI4APFjWKGL92u6c9WUjgWBNUphgLWlQ" Subject: Re: [Qemu-devel] [PATCH v5 7/8] qom: add a object_property_add_enum helper method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BHI4APFjWKGL92u6c9WUjgWBNUphgLWlQ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/27/2015 09:07 AM, Daniel P. Berrange wrote: > A QOM property can be parsed as enum using the visit_type_enum() > helper method, but this forces callers to use the more complex > generic object_property_add() method when registering it. It > also requires that users of that object have access to the > string map when they want to read the property value. >=20 > This patch introduces a specialized object_property_add_enum() > method which simplifies the use of enum properties, so the > setters/getters directly get passed the int value. >=20 > typedef enum { > /** > + * object_property_add_enum: > + * @obj: the object to add a property to > + * @name: the name of the property > + * @typename: the name of the enum data type > + * @get: the getter or %NULL if the property is write-only. > + * @set: the setter or %NULL if the property is read-only > + * @errp: if an error occurs, a pointer to an area to store the error > + * > + * Add a enum property using getters/setters. This function will add = a s/a enum/an enum/ > +static void property_release_enum(Object *obj, const char *name, > + void *opaque) > +{ > + EnumProperty *prop =3D opaque; > + g_free(prop); Could also be written as g_free(opaque), but that's a little less readable, so I don't see a point in changing it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --BHI4APFjWKGL92u6c9WUjgWBNUphgLWlQ 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/ iQEcBAEBCAAGBQJVhD96AAoJEKeha0olJ0NqOPQH/23YX42w3OImWVSGNJ+cWCqT DqkTmmIVh+U1GMGhgOKvxlc7CDvJqYoItwIXb220o9wcO2I3m4FhzzscXyovJkKo Y1CTKTylHTPzXl6mOvv83afddAppgGeVC7B5NofNPXyztx0tXX1dTnjw6t1Yr2tH yj8dn4tBrYHzZy7aeLn5r5fyKH3/CzrEMf8xCZRcfONdmKALb7dTL64QMqTm/Pi4 zYMBas2PExgZeZXKx5TBGwuS4l4V3msN+bLx9Tx6Qd8ZTJ/VU4SDKsJWus7ywWon mDsYZv99OsuGnwOw8rBhOSfudi+7AqFpGPJzD2XmkXuGXm+lZQP2I9YpKfHXV2Q= =vnwE -----END PGP SIGNATURE----- --BHI4APFjWKGL92u6c9WUjgWBNUphgLWlQ--