aboutsummaryrefslogtreecommitdiff
path: root/target/ppc/translate_init.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2017-08-30 15:24:29 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2017-09-08 09:30:55 +1000
commitc9137065814609111ec0ed29246388f4ad086732 (patch)
treee97ebfb1e7aefe453fe46d935f4a06f77a08ec40 /target/ppc/translate_init.c
parentbf1457bdbb736a54eb2eb70bc531e11eb468de7e (diff)
ppc: use macros to make cpu type name from string literal
Replace "-" TYPE_POWERPC_CPU when composing cpu type name from cpu model string literal and the same pattern in format strings with POWERPC_CPU_TYPE_SUFFIX and POWERPC_CPU_TYPE_NAME(model) macroses like we do in x86. Later POWERPC_CPU_TYPE_NAME() will be used to define default cpu type per machine type and as bonus it will be consistent and easy grep-able pattern across all other targets that I'm plannig to treat the same way. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'target/ppc/translate_init.c')
-rw-r--r--target/ppc/translate_init.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index 703ea12f2a..ee42c56288 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -10261,7 +10261,7 @@ static gint ppc_cpu_compare_class_name(gconstpointer a, gconstpointer b)
if (strncasecmp(name, object_class_get_name(oc), strlen(name)) == 0 &&
ppc_cpu_is_valid(pcc) &&
strcmp(object_class_get_name(oc) + strlen(name),
- "-" TYPE_POWERPC_CPU) == 0) {
+ POWERPC_CPU_TYPE_SUFFIX) == 0) {
return 0;
}
return -1;
@@ -10403,7 +10403,7 @@ static void ppc_cpu_list_entry(gpointer data, gpointer user_data)
}
name = g_strndup(typename,
- strlen(typename) - strlen("-" TYPE_POWERPC_CPU));
+ strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
(*s->cpu_fprintf)(s->file, "PowerPC %-16s PVR %08x\n",
name, pcc->pvr);
for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) {
@@ -10464,7 +10464,7 @@ static void ppc_cpu_defs_entry(gpointer data, gpointer user_data)
typename = object_class_get_name(oc);
info = g_malloc0(sizeof(*info));
info->name = g_strndup(typename,
- strlen(typename) - strlen("-" TYPE_POWERPC_CPU));
+ strlen(typename) - strlen(POWERPC_CPU_TYPE_SUFFIX));
entry = g_malloc0(sizeof(*entry));
entry->value = info;