* [Qemu-devel] [PATCH] qom: remove type_initialize() in object_new_with_type()
@ 2019-03-01 7:44 Wei Yang
2019-03-01 9:33 ` Igor Mammedov
0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2019-03-01 7:44 UTC (permalink / raw)
To: qemu-devel; +Cc: afaerber, Wei Yang
Here is the abstraction of current call flow of object_new_with_type()
object_initialize_with_type
type_initialize
object_initialize_with_type
type_initialize
This is not necessary to spread type_initialize in two places.
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
qom/object.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/qom/object.c b/qom/object.c
index b8c732063b..6252cca418 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -585,7 +585,6 @@ static Object *object_new_with_type(Type type)
Object *obj;
g_assert(type != NULL);
- type_initialize(type);
obj = g_malloc(type->instance_size);
object_initialize_with_type(obj, type->instance_size, type);
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qom: remove type_initialize() in object_new_with_type()
2019-03-01 7:44 [Qemu-devel] [PATCH] qom: remove type_initialize() in object_new_with_type() Wei Yang
@ 2019-03-01 9:33 ` Igor Mammedov
2019-03-02 11:38 ` Wei Yang
0 siblings, 1 reply; 3+ messages in thread
From: Igor Mammedov @ 2019-03-01 9:33 UTC (permalink / raw)
To: Wei Yang; +Cc: qemu-devel, afaerber
On Fri, 1 Mar 2019 15:44:48 +0800
Wei Yang <richardw.yang@linux.intel.com> wrote:
> Here is the abstraction of current call flow of object_new_with_type()
>
> object_initialize_with_type
> type_initialize
> object_initialize_with_type
> type_initialize
>
> This is not necessary to spread type_initialize in two places.
>
> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
> ---
> qom/object.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/qom/object.c b/qom/object.c
> index b8c732063b..6252cca418 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -585,7 +585,6 @@ static Object *object_new_with_type(Type type)
> Object *obj;
>
> g_assert(type != NULL);
> - type_initialize(type);
>
> obj = g_malloc(type->instance_size);
> object_initialize_with_type(obj, type->instance_size, type);
Are you sure it's correct?
see how type->instance_size
PS:
there is also unit-tests which might detect issues in patches before
one sends them. To execute them run: make check
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] qom: remove type_initialize() in object_new_with_type()
2019-03-01 9:33 ` Igor Mammedov
@ 2019-03-02 11:38 ` Wei Yang
0 siblings, 0 replies; 3+ messages in thread
From: Wei Yang @ 2019-03-02 11:38 UTC (permalink / raw)
To: Igor Mammedov; +Cc: Wei Yang, qemu-devel, afaerber
On Fri, Mar 01, 2019 at 10:33:46AM +0100, Igor Mammedov wrote:
>On Fri, 1 Mar 2019 15:44:48 +0800
>Wei Yang <richardw.yang@linux.intel.com> wrote:
>
>> Here is the abstraction of current call flow of object_new_with_type()
>>
>> object_initialize_with_type
>> type_initialize
>> object_initialize_with_type
>> type_initialize
>>
>> This is not necessary to spread type_initialize in two places.
>>
>> Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
>> ---
>> qom/object.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/qom/object.c b/qom/object.c
>> index b8c732063b..6252cca418 100644
>> --- a/qom/object.c
>> +++ b/qom/object.c
>> @@ -585,7 +585,6 @@ static Object *object_new_with_type(Type type)
>> Object *obj;
>>
>> g_assert(type != NULL);
>> - type_initialize(type);
>>
>> obj = g_malloc(type->instance_size);
>> object_initialize_with_type(obj, type->instance_size, type);
>Are you sure it's correct?
>
>see how type->instance_size
>
You are right, I thought the instance_size is initialized in type_new().
But this would be adjusted in type_initialize() again.
>PS:
>there is also unit-tests which might detect issues in patches before
>one sends them. To execute them run: make check
>
With this patch applied, I managed to run a guest successfully. Looks
this didn't catch some corner case.
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-02 11:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-01 7:44 [Qemu-devel] [PATCH] qom: remove type_initialize() in object_new_with_type() Wei Yang
2019-03-01 9:33 ` Igor Mammedov
2019-03-02 11:38 ` Wei Yang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.