提交 945776db 编写于 作者: J Jiri Denemark

cpu_x86: Simplify insertions into a linked list

The next pointer is initialized to NULL, overwriting to with another
NULL doesn't hurt.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 26bfa2a6
...@@ -563,12 +563,8 @@ x86VendorLoad(xmlXPathContextPtr ctxt, ...@@ -563,12 +563,8 @@ x86VendorLoad(xmlXPathContextPtr ctxt,
vendor->cpuid.edx = virReadBufInt32LE(string + 4); vendor->cpuid.edx = virReadBufInt32LE(string + 4);
vendor->cpuid.ecx = virReadBufInt32LE(string + 8); vendor->cpuid.ecx = virReadBufInt32LE(string + 8);
if (!map->vendors) {
map->vendors = vendor;
} else {
vendor->next = map->vendors; vendor->next = map->vendors;
map->vendors = vendor; map->vendors = vendor;
}
cleanup: cleanup:
VIR_FREE(string); VIR_FREE(string);
...@@ -768,12 +764,8 @@ x86FeatureLoad(xmlXPathContextPtr ctxt, ...@@ -768,12 +764,8 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
map->migrate_blockers = migrate_blocker; map->migrate_blockers = migrate_blocker;
} }
if (!map->features) {
map->features = feature;
} else {
feature->next = map->features; feature->next = map->features;
map->features = feature; map->features = feature;
}
cleanup: cleanup:
ctxt->node = ctxt_node; ctxt->node = ctxt_node;
...@@ -1108,12 +1100,8 @@ x86ModelLoad(xmlXPathContextPtr ctxt, ...@@ -1108,12 +1100,8 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
goto error; goto error;
} }
if (!map->models) {
map->models = model;
} else {
model->next = map->models; model->next = map->models;
map->models = model; map->models = model;
}
cleanup: cleanup:
VIR_FREE(vendor); VIR_FREE(vendor);
...@@ -1209,13 +1197,8 @@ x86MapLoadInternalFeatures(virCPUx86MapPtr map) ...@@ -1209,13 +1197,8 @@ x86MapLoadInternalFeatures(virCPUx86MapPtr map)
if (virCPUx86DataAddCPUID(feature->data, &x86_kvm_features[i].cpuid)) if (virCPUx86DataAddCPUID(feature->data, &x86_kvm_features[i].cpuid))
goto error; goto error;
if (!map->features) {
map->features = feature;
} else {
feature->next = map->features; feature->next = map->features;
map->features = feature; map->features = feature;
}
feature = NULL; feature = NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册