aboutsummaryrefslogtreecommitdiff
path: root/target-ppc/translate_init.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-02-17 23:16:40 +0000
committerAlexander Graf <agraf@suse.de>2013-03-08 21:04:50 +0100
commitde400129daf3ff0f7468363f6d886fcdcc626ea6 (patch)
tree339cb345563b187701df8d1f37ed1e1b5f98d583 /target-ppc/translate_init.c
parentf591784b639c72138f0cfd30b46dcf328f9adc8b (diff)
target-ppc: Get model name from type name
We are about to drop the redundant name field along with ppc_def_t. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/translate_init.c')
-rw-r--r--target-ppc/translate_init.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 9d4831fbaa..7eb565d205 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -9979,9 +9979,14 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
ObjectClass *oc = data;
CPUListState *s = user_data;
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
+ const char *typename = object_class_get_name(oc);
+ char *name;
+ name = g_strndup(typename,
+ strlen(typename) - strlen("-" TYPE_POWERPC_CPU));
(*s->cpu_fprintf)(s->file, "PowerPC %-16s PVR %08x\n",
- pcc->info->name, pcc->info->pvr);
+ name, pcc->info->pvr);
+ g_free(name);
}
void ppc_cpu_list(FILE *f, fprintf_function cpu_fprintf)
@@ -10014,12 +10019,14 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
{
ObjectClass *oc = data;
CpuDefinitionInfoList **first = user_data;
- PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
+ const char *typename;
CpuDefinitionInfoList *entry;
CpuDefinitionInfo *info;
+ typename = object_class_get_name(oc);
info = g_malloc0(sizeof(*info));
- info->name = g_strdup(pcc->info->name);
+ info->name = g_strndup(typename,
+ strlen(typename) - strlen("-" TYPE_POWERPC_CPU));
entry = g_malloc0(sizeof(*entry));
entry->value = info;