Skip to contentSkip to conversation

target-arm: use type_register() instead of type_register_static()

PATCH Applied Eduardo Habkost 2 participants 3 messages Nov 28, 2012 – Dec 4, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-arm: use type_register() instead of type_register_static()

The type_register_static() interface is documented as:

type_register_static:
@info: The #TypeInfo of the new type.

@info and all of the strings it points to should exist for the life time that the type is registered.

But cpu_register() uses a stack variable for the 'info' argument, so it has to use type_register() instead of type_register_static().

---
 target-arm/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-arm/cpu.c +1 -1
index b00f5fa..ac914d2 100644
@@ -778,7 +778,7 @@ static void cpu_register(const ARMCPUInfo *info)
         .class_size = sizeof(ARMCPUClass),
     };
 
-    type_register_static(&type_info);
+    type_register(&type_info);
 }
 
 static const TypeInfo arm_cpu_type_info = {
Signature · 1 line
1.7.11.7
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Eduardo Habkost

The type_register_static() interface is documented as:

type_register_static:
@info: The #TypeInfo of the new type.

@info and all of the strings it points to should exist for the life time that the type is registered.

But cpu_register() uses a stack variable for the 'info' argument, so it has to use type_register() instead of type_register_static().

though it seems a bit odd that we make this distinction in the API even though type_register_static() just calls type_register()...

-- PMM

#2 lore raw
In reply to Eduardo Habkost
Quoted 5 lines · Eduardo Habkost

The type_register_static() interface is documented as:

type_register_static:
@info: The #TypeInfo of the new type.

Quoted 7 lines

@info and all of the strings it points to should exist for the life time that the type is registered.

But cpu_register() uses a stack variable for the 'info' argument, so it has to use type_register() instead of type_register_static().

Thanks, applied to target-arm.next.

-- PMM