Am 19.06.2015 um 18:12 schrieb Eric Blake: > 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. >> >> 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. >> >> 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/
Thanks, fixed on https://github.com/afaerber/qemu-cpu/commits/qom-next >> +static void property_release_enum(Object *obj, const char *name, >> + void *opaque) >> +{ >> + EnumProperty *prop = 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. I prefer it this way. Consuming opaques directly broke a few call sites when I refactored the CPU structs, so the savings of one line is not really worth it IMO. Regards, Andreas -- SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton; HRB 21284 (AG Nürnberg)
signature.asc
Description: OpenPGP digital signature