mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
qapi: Use QAPI_LIST_APPEND in trivial cases
The easiest spots to use QAPI_LIST_APPEND are where we already have an obvious pointer to the tail of a list. While at it, consistently use the variable name 'tail' for that purpose. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210113221013.390592-5-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
dc13f40c6b
commit
c3033fd372
20 changed files with 96 additions and 222 deletions
|
@ -4818,20 +4818,17 @@ static void x86_cpu_filter_features(X86CPU *cpu, bool verbose);
|
|||
|
||||
/* Build a list with the name of all features on a feature word array */
|
||||
static void x86_cpu_list_feature_names(FeatureWordArray features,
|
||||
strList **feat_names)
|
||||
strList **list)
|
||||
{
|
||||
strList **tail = list;
|
||||
FeatureWord w;
|
||||
strList **next = feat_names;
|
||||
|
||||
for (w = 0; w < FEATURE_WORDS; w++) {
|
||||
uint64_t filtered = features[w];
|
||||
int i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
if (filtered & (1ULL << i)) {
|
||||
strList *new = g_new0(strList, 1);
|
||||
new->value = g_strdup(x86_cpu_feature_name(w, i));
|
||||
*next = new;
|
||||
next = &new->next;
|
||||
QAPI_LIST_APPEND(tail, g_strdup(x86_cpu_feature_name(w, i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4852,16 +4849,14 @@ static void x86_cpu_get_unavailable_features(Object *obj, Visitor *v,
|
|||
* running using the current machine and accelerator.
|
||||
*/
|
||||
static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
|
||||
strList **missing_feats)
|
||||
strList **list)
|
||||
{
|
||||
strList **tail = list;
|
||||
X86CPU *xc;
|
||||
Error *err = NULL;
|
||||
strList **next = missing_feats;
|
||||
|
||||
if (xcc->host_cpuid_required && !accel_uses_host_cpuid()) {
|
||||
strList *new = g_new0(strList, 1);
|
||||
new->value = g_strdup("kvm");
|
||||
*missing_feats = new;
|
||||
QAPI_LIST_APPEND(tail, g_strdup("kvm"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4873,16 +4868,13 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
|
|||
* but in case it does, just report the model as not
|
||||
* runnable at all using the "type" property.
|
||||
*/
|
||||
strList *new = g_new0(strList, 1);
|
||||
new->value = g_strdup("type");
|
||||
*next = new;
|
||||
next = &new->next;
|
||||
QAPI_LIST_APPEND(tail, g_strdup("type"));
|
||||
error_free(err);
|
||||
}
|
||||
|
||||
x86_cpu_filter_features(xc, false);
|
||||
|
||||
x86_cpu_list_feature_names(xc->filtered_features, next);
|
||||
x86_cpu_list_feature_names(xc->filtered_features, tail);
|
||||
|
||||
object_unref(OBJECT(xc));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue