Revision | 55644f59df13443b5058cf8f445925284600e36e (tree) |
---|---|
Time | 2019-06-16 22:31:40 |
Author | Yoshinori Sato <ysato@user...> |
Commiter | Yoshinori Sato |
target/rx: simplify rx_cpu_class_by_name
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
@@ -72,9 +72,8 @@ static void rx_cpu_reset(CPUState *s) | ||
72 | 72 | static void rx_cpu_list_entry(gpointer data, gpointer user_data) |
73 | 73 | { |
74 | 74 | const char *typename = object_class_get_name(OBJECT_CLASS(data)); |
75 | - int len = strlen(typename) - strlen(RX_CPU_TYPE_SUFFIX); | |
76 | 75 | |
77 | - qemu_printf("%.*s\n", len, typename); | |
76 | + qemu_printf("%s\n", typename); | |
78 | 77 | } |
79 | 78 | |
80 | 79 | void rx_cpu_list(void) |
@@ -88,25 +87,12 @@ void rx_cpu_list(void) | ||
88 | 87 | static ObjectClass *rx_cpu_class_by_name(const char *cpu_model) |
89 | 88 | { |
90 | 89 | ObjectClass *oc; |
91 | - char *typename; | |
92 | 90 | |
93 | 91 | oc = object_class_by_name(cpu_model); |
94 | - if (oc != NULL && object_class_dynamic_cast(oc, TYPE_RX_CPU) != NULL && | |
95 | - !object_class_is_abstract(oc)) { | |
96 | - return oc; | |
97 | - } | |
98 | - | |
99 | - typename = g_strdup_printf(RX_CPU_TYPE_NAME("%s"), cpu_model); | |
100 | - oc = object_class_by_name(typename); | |
101 | - if (oc != NULL && object_class_is_abstract(oc)) { | |
92 | + if (object_class_dynamic_cast(oc, TYPE_RX_CPU) == NULL || | |
93 | + object_class_is_abstract(oc)) { | |
102 | 94 | oc = NULL; |
103 | 95 | } |
104 | - g_free(typename); | |
105 | - | |
106 | - if (!oc) { | |
107 | - /* default to rx62n */ | |
108 | - oc = object_class_by_name(TYPE_RX62N_CPU); | |
109 | - } | |
110 | 96 | |
111 | 97 | return oc; |
112 | 98 | } |