qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 1/8] apic: add global apic_get_class()


From: Eduardo Habkost
Subject: Re: [Qemu-devel] [PATCH v3 1/8] apic: add global apic_get_class()
Date: Tue, 4 Oct 2016 13:14:18 -0300
User-agent: Mutt/1.7.0 (2016-08-17)

On Tue, Oct 04, 2016 at 03:38:01PM +0200, Radim Krčmář wrote:
> 2016-10-03 13:03-0300, Eduardo Habkost:
> > On Fri, Sep 30, 2016 at 06:10:06PM +0200, Radim Krčmář wrote:
[...]
> >> +static void x86_cpu_apic_create(X86CPU *cpu, Error **errp)
> >> +{
> >> +    APICCommonState *apic;
> >> +    ObjectClass *apic_object_class = OBJECT_CLASS(apic_get_class());
> >> +
> >> +    assert(apic_object_class);
> >> +    cpu->apic_state = 
> >> DEVICE(object_new_with_type(apic_object_class->type));
> > 
> > ObjectClass::type is private. I believe the common idiom is
> > object_new(object_class_get_name(c)).
> 
> Will fix in v4.
> 
> object_class_get_name() loses information about the type, so
> object_new() has to look it up from the name, which is unnecessary.

True.

> 
> Should I follow with a patch/series that adds
> 
>   Object *object_new_with_class(ObjectClass *class)
>   {
>       return object_new_with_type(class->type);
>   }
> 
> into qom/object.[ch] and replaces occurrences of
> object_new_with_type(object_class_get_name()) with it?

I think that would be welcome. I don't know why it doesn't exist
yet.

-- 
Eduardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]