Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
26bfa2a6
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
26bfa2a6
编写于
5月 12, 2016
作者:
J
Jiri Denemark
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cpu_x86: Remove comparisons to NULL
Signed-off-by:
N
Jiri Denemark
<
jdenemar@redhat.com
>
上级
aa9e0ef0
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
33 addition
and
33 deletion
+33
-33
src/cpu/cpu_x86.c
src/cpu/cpu_x86.c
+33
-33
未找到文件。
src/cpu/cpu_x86.c
浏览文件 @
26bfa2a6
...
...
@@ -248,7 +248,7 @@ x86DataCpuid(const virCPUx86Data *data,
void
virCPUx86DataFree
(
virCPUx86Data
*
data
)
{
if
(
data
==
NULL
)
if
(
!
data
)
return
;
VIR_FREE
(
data
->
data
);
...
...
@@ -384,7 +384,7 @@ x86DataIsEmpty(virCPUx86Data *data)
{
virCPUx86DataIterator
iter
=
virCPUx86DataIteratorInit
(
data
);
return
x86DataCpuidNext
(
&
iter
)
==
NULL
;
return
!
x86DataCpuidNext
(
&
iter
)
;
}
...
...
@@ -416,7 +416,7 @@ x86DataToCPUFeatures(virCPUDefPtr cpu,
{
virCPUx86FeaturePtr
feature
=
map
->
features
;
while
(
feature
!=
NULL
)
{
while
(
feature
)
{
if
(
x86DataIsSubset
(
data
,
feature
->
data
))
{
x86DataSubtract
(
data
,
feature
->
data
);
if
(
virCPUDefAddFeature
(
cpu
,
feature
->
name
,
policy
)
<
0
)
...
...
@@ -603,7 +603,7 @@ x86FeatureNew(void)
static
void
x86FeatureFree
(
virCPUx86FeaturePtr
feature
)
{
if
(
feature
==
NULL
)
if
(
!
feature
)
return
;
VIR_FREE
(
feature
->
name
);
...
...
@@ -623,7 +623,7 @@ x86FeatureCopy(virCPUx86FeaturePtr src)
if
(
VIR_STRDUP
(
feature
->
name
,
src
->
name
)
<
0
)
goto
error
;
if
(
(
feature
->
data
=
x86DataCopy
(
src
->
data
))
==
NULL
)
if
(
!
(
feature
->
data
=
x86DataCopy
(
src
->
data
))
)
goto
error
;
return
feature
;
...
...
@@ -641,7 +641,7 @@ x86FeatureFind(virCPUx86MapPtr map,
virCPUx86FeaturePtr
feature
;
feature
=
map
->
features
;
while
(
feature
!=
NULL
)
{
while
(
feature
)
{
if
(
STREQ
(
feature
->
name
,
name
))
return
feature
;
...
...
@@ -728,7 +728,7 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
goto
error
;
feature
->
name
=
virXPathString
(
"string(@name)"
,
ctxt
);
if
(
feature
->
name
==
NULL
)
{
if
(
!
feature
->
name
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Missing CPU feature name"
));
goto
ignore
;
...
...
@@ -761,14 +761,14 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
}
if
(
!
migratable
)
{
if
(
(
migrate_blocker
=
x86FeatureCopy
(
feature
))
==
NULL
)
if
(
!
(
migrate_blocker
=
x86FeatureCopy
(
feature
))
)
goto
error
;
migrate_blocker
->
next
=
map
->
migrate_blockers
;
map
->
migrate_blockers
=
migrate_blocker
;
}
if
(
map
->
features
==
NULL
)
{
if
(
!
map
->
features
)
{
map
->
features
=
feature
;
}
else
{
feature
->
next
=
map
->
features
;
...
...
@@ -842,7 +842,7 @@ x86ModelNew(void)
static
void
x86ModelFree
(
virCPUx86ModelPtr
model
)
{
if
(
model
==
NULL
)
if
(
!
model
)
return
;
VIR_FREE
(
model
->
name
);
...
...
@@ -876,7 +876,7 @@ x86ModelFind(virCPUx86MapPtr map,
virCPUx86ModelPtr
model
;
model
=
map
->
models
;
while
(
model
!=
NULL
)
{
while
(
model
)
{
if
(
STREQ
(
model
->
name
,
name
))
return
model
;
...
...
@@ -896,13 +896,13 @@ x86ModelFromCPU(const virCPUDef *cpu,
size_t
i
;
if
(
policy
==
VIR_CPU_FEATURE_REQUIRE
)
{
if
(
(
model
=
x86ModelFind
(
map
,
cpu
->
model
))
==
NULL
)
{
if
(
!
(
model
=
x86ModelFind
(
map
,
cpu
->
model
))
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Unknown CPU model %s"
),
cpu
->
model
);
goto
error
;
}
if
(
(
model
=
x86ModelCopy
(
model
))
==
NULL
)
if
(
!
(
model
=
x86ModelCopy
(
model
))
)
goto
error
;
}
else
if
(
!
(
model
=
x86ModelNew
()))
{
goto
error
;
...
...
@@ -917,7 +917,7 @@ x86ModelFromCPU(const virCPUDef *cpu,
&&
cpu
->
features
[
i
].
policy
!=
policy
)
continue
;
if
(
(
feature
=
x86FeatureFind
(
map
,
cpu
->
features
[
i
].
name
))
==
NULL
)
{
if
(
!
(
feature
=
x86FeatureFind
(
map
,
cpu
->
features
[
i
].
name
))
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Unknown CPU feature %s"
),
cpu
->
features
[
i
].
name
);
goto
error
;
...
...
@@ -1030,25 +1030,25 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
goto
error
;
model
->
name
=
virXPathString
(
"string(@name)"
,
ctxt
);
if
(
model
->
name
==
NULL
)
{
if
(
!
model
->
name
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Missing CPU model name"
));
goto
ignore
;
}
if
(
virXPathNode
(
"./model"
,
ctxt
)
!=
NULL
)
{
if
(
virXPathNode
(
"./model"
,
ctxt
))
{
virCPUx86ModelPtr
ancestor
;
char
*
name
;
name
=
virXPathString
(
"string(./model/@name)"
,
ctxt
);
if
(
name
==
NULL
)
{
if
(
!
name
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Missing ancestor's name in CPU model %s"
),
model
->
name
);
goto
ignore
;
}
if
(
(
ancestor
=
x86ModelFind
(
map
,
name
))
==
NULL
)
{
if
(
!
(
ancestor
=
x86ModelFind
(
map
,
name
))
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Ancestor model %s not found for CPU model %s"
),
name
,
model
->
name
);
...
...
@@ -1089,13 +1089,13 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
virCPUx86FeaturePtr
feature
;
char
*
name
;
if
(
(
name
=
virXMLPropString
(
nodes
[
i
],
"name"
))
==
NULL
)
{
if
(
!
(
name
=
virXMLPropString
(
nodes
[
i
],
"name"
))
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Missing feature name for CPU model %s"
),
model
->
name
);
goto
ignore
;
}
if
(
(
feature
=
x86FeatureFind
(
map
,
name
))
==
NULL
)
{
if
(
!
(
feature
=
x86FeatureFind
(
map
,
name
))
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
_
(
"Feature %s required by CPU model %s not found"
),
name
,
model
->
name
);
...
...
@@ -1108,7 +1108,7 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
goto
error
;
}
if
(
map
->
models
==
NULL
)
{
if
(
!
map
->
models
)
{
map
->
models
=
model
;
}
else
{
model
->
next
=
map
->
models
;
...
...
@@ -1132,28 +1132,28 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
static
void
x86MapFree
(
virCPUx86MapPtr
map
)
{
if
(
map
==
NULL
)
if
(
!
map
)
return
;
while
(
map
->
features
!=
NULL
)
{
while
(
map
->
features
)
{
virCPUx86FeaturePtr
feature
=
map
->
features
;
map
->
features
=
feature
->
next
;
x86FeatureFree
(
feature
);
}
while
(
map
->
models
!=
NULL
)
{
while
(
map
->
models
)
{
virCPUx86ModelPtr
model
=
map
->
models
;
map
->
models
=
model
->
next
;
x86ModelFree
(
model
);
}
while
(
map
->
vendors
!=
NULL
)
{
while
(
map
->
vendors
)
{
virCPUx86VendorPtr
vendor
=
map
->
vendors
;
map
->
vendors
=
vendor
->
next
;
x86VendorFree
(
vendor
);
}
while
(
map
->
migrate_blockers
!=
NULL
)
{
while
(
map
->
migrate_blockers
)
{
virCPUx86FeaturePtr
migrate_blocker
=
map
->
migrate_blockers
;
map
->
migrate_blockers
=
migrate_blocker
->
next
;
x86FeatureFree
(
migrate_blocker
);
...
...
@@ -1209,7 +1209,7 @@ x86MapLoadInternalFeatures(virCPUx86MapPtr map)
if
(
virCPUx86DataAddCPUID
(
feature
->
data
,
&
x86_kvm_features
[
i
].
cpuid
))
goto
error
;
if
(
map
->
features
==
NULL
)
{
if
(
!
map
->
features
)
{
map
->
features
=
feature
;
}
else
{
feature
->
next
=
map
->
features
;
...
...
@@ -1469,7 +1469,7 @@ x86Compute(virCPUDefPtr host,
ret
=
VIR_CPU_COMPARE_IDENTICAL
;
if
(
(
diff
=
x86ModelCopy
(
host_model
))
==
NULL
)
if
(
!
(
diff
=
x86ModelCopy
(
host_model
))
)
goto
error
;
x86DataSubtract
(
diff
->
data
,
cpu_optional
->
data
);
...
...
@@ -1489,10 +1489,10 @@ x86Compute(virCPUDefPtr host,
goto
cleanup
;
}
if
(
guest
!=
NULL
)
{
if
(
guest
)
{
virCPUx86Data
*
guestData
;
if
(
(
guest_model
=
x86ModelCopy
(
host_model
))
==
NULL
)
if
(
!
(
guest_model
=
x86ModelCopy
(
host_model
))
)
goto
error
;
if
(
cpu
->
type
==
VIR_CPU_TYPE_GUEST
...
...
@@ -1671,7 +1671,7 @@ x86Decode(virCPUDefPtr cpu,
}
}
if
(
cpuModel
==
NULL
)
{
if
(
!
cpuModel
)
{
virReportError
(
VIR_ERR_INTERNAL_ERROR
,
"%s"
,
_
(
"Cannot find suitable CPU model for given data"
));
goto
cleanup
;
...
...
@@ -1780,7 +1780,7 @@ x86Encode(virArch arch,
if
(
vendor
)
*
vendor
=
NULL
;
if
(
(
map
=
virCPUx86GetMap
())
==
NULL
)
if
(
!
(
map
=
virCPUx86GetMap
())
)
goto
error
;
if
(
forced
)
{
...
...
@@ -2243,7 +2243,7 @@ x86GetModels(char ***models)
goto
error
;
model
=
map
->
models
;
while
(
model
!=
NULL
)
{
while
(
model
)
{
if
(
models
)
{
if
(
VIR_STRDUP
(
name
,
model
->
name
)
<
0
)
goto
error
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录