From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuPAg-0007BQ-HG for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:04:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RuPAa-0005ad-IV for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:03:54 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:45729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuPAa-0005aU-Dl for qemu-devel@nongnu.org; Mon, 06 Feb 2012 09:03:48 -0500 Received: by dadp14 with SMTP id p14so6463112dad.4 for ; Mon, 06 Feb 2012 06:03:47 -0800 (PST) Message-ID: <4F2FDDBF.90809@codemonkey.ws> Date: Mon, 06 Feb 2012 08:03:43 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1328342577-25732-1-git-send-email-pbonzini@redhat.com> <1328342577-25732-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1328342577-25732-2-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 01/27] qom: clean up cast macros List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 02/04/2012 02:02 AM, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini Reviewed-by: Anthony Liguori Regards, Anthony Liguori > --- > include/qemu/object.h | 22 +++++++++++++++------- > 1 files changed, 15 insertions(+), 7 deletions(-) > > diff --git a/include/qemu/object.h b/include/qemu/object.h > index 9d0251d..ab1c48c 100644 > --- a/include/qemu/object.h > +++ b/include/qemu/object.h > @@ -259,6 +259,16 @@ struct TypeInfo > ((Object *)(obj)) > > /** > + * OBJECT_CLASS: > + * @class: A derivative of #ObjectClas. > + * > + * Converts a class to an #ObjectClass. Since all objects are #Objects, > + * this function will always succeed. > + */ > +#define OBJECT_CLASS(class) \ > + ((ObjectClass *)(class)) > + > +/** > * OBJECT_CHECK: > * @type: The C type to use for the return value. > * @obj: A derivative of @type to cast. > @@ -272,7 +282,7 @@ struct TypeInfo > * generated. > */ > #define OBJECT_CHECK(type, obj, name) \ > - ((type *)object_dynamic_cast_assert((Object *)(obj), (name))) > + ((type *)object_dynamic_cast_assert(OBJECT(obj), (name))) > > /** > * OBJECT_CLASS_CHECK: > @@ -280,11 +290,12 @@ struct TypeInfo > * @obj: A derivative of @type to cast. > * @name: the QOM typename of @class. > * > - * A type safe version of @object_check_class. This macro is typically wrapped > - * by each type to perform type safe casts of a class to a specific class type. > + * A type safe version of @object_class_dynamic_cast_assert. This macro is > + * typically wrapped by each type to perform type safe casts of a class to a > + * specific class type. > */ > #define OBJECT_CLASS_CHECK(class, obj, name) \ > - ((class *)object_class_dynamic_cast_assert((ObjectClass *)(obj), (name))) > + ((class *)object_class_dynamic_cast_assert(OBJECT_CLASS(obj), (name))) > > /** > * OBJECT_GET_CLASS: > @@ -299,9 +310,6 @@ struct TypeInfo > #define OBJECT_GET_CLASS(class, obj, name) \ > OBJECT_CLASS_CHECK(class, object_get_class(OBJECT(obj)), name) > > -#define OBJECT_CLASS(class) \ > - ((ObjectClass *)(class)) > - > /** > * InterfaceClass: > * @parent_class: the base class