Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
4960022a
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,发现更多精彩内容 >>
提交
4960022a
编写于
5月 03, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_STRDUP and VIR_STRNDUP in src/*
上级
e60b9783
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
56 deletion
+41
-56
src/datatypes.c
src/datatypes.c
+36
-42
src/libvirt.c
src/libvirt.c
+4
-10
src/nodeinfo.c
src/nodeinfo.c
+1
-4
未找到文件。
src/datatypes.c
浏览文件 @
4960022a
...
...
@@ -27,6 +27,7 @@
#include "virlog.h"
#include "viralloc.h"
#include "viruuid.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_NONE
...
...
@@ -225,8 +226,8 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid)
if
(
!
(
ret
=
virObjectNew
(
virDomainClass
)))
return
NULL
;
if
(
!
(
ret
->
name
=
strdup
(
name
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
name
,
name
)
<
0
)
goto
error
;
ret
->
conn
=
virObjectRef
(
conn
);
ret
->
id
=
-
1
;
...
...
@@ -234,8 +235,7 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid)
return
ret
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
@@ -297,16 +297,15 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid)
if
(
!
(
ret
=
virObjectNew
(
virNetworkClass
)))
return
NULL
;
if
(
!
(
ret
->
name
=
strdup
(
name
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
name
,
name
)
<
0
)
goto
error
;
ret
->
conn
=
virObjectRef
(
conn
);
memcpy
(
&
(
ret
->
uuid
[
0
]),
uuid
,
VIR_UUID_BUFLEN
);
return
ret
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
@@ -372,17 +371,15 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac)
if
(
!
(
ret
=
virObjectNew
(
virInterfaceClass
)))
return
NULL
;
if
(
!
(
ret
->
name
=
strdup
(
name
)))
goto
no_memory
;
if
(
!
(
ret
->
mac
=
strdup
(
mac
)))
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
name
,
name
)
<
0
||
VIR_STRDUP
(
ret
->
mac
,
mac
)
<
0
)
goto
error
;
ret
->
conn
=
virObjectRef
(
conn
);
return
ret
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
@@ -446,8 +443,8 @@ virGetStoragePool(virConnectPtr conn, const char *name,
if
(
!
(
ret
=
virObjectNew
(
virStoragePoolClass
)))
return
NULL
;
if
(
!
(
ret
->
name
=
strdup
(
name
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
name
,
name
)
<
0
)
goto
error
;
ret
->
conn
=
virObjectRef
(
conn
);
memcpy
(
&
(
ret
->
uuid
[
0
]),
uuid
,
VIR_UUID_BUFLEN
);
...
...
@@ -458,8 +455,7 @@ virGetStoragePool(virConnectPtr conn, const char *name,
return
ret
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
@@ -530,12 +526,10 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name,
if
(
!
(
ret
=
virObjectNew
(
virStorageVolClass
)))
return
NULL
;
if
(
!
(
ret
->
pool
=
strdup
(
pool
)))
goto
no_memory
;
if
(
!
(
ret
->
name
=
strdup
(
name
)))
goto
no_memory
;
if
(
!
(
ret
->
key
=
strdup
(
key
)))
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
pool
,
pool
)
<
0
||
VIR_STRDUP
(
ret
->
name
,
name
)
<
0
||
VIR_STRDUP
(
ret
->
key
,
key
)
<
0
)
goto
error
;
ret
->
conn
=
virObjectRef
(
conn
);
...
...
@@ -545,8 +539,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name,
return
ret
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
@@ -610,13 +603,13 @@ virGetNodeDevice(virConnectPtr conn, const char *name)
if
(
!
(
ret
=
virObjectNew
(
virNodeDeviceClass
)))
return
NULL
;
if
(
!
(
ret
->
name
=
strdup
(
name
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
name
,
name
)
<
0
)
goto
error
;
ret
->
conn
=
virObjectRef
(
conn
);
return
ret
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
@@ -680,14 +673,14 @@ virGetSecret(virConnectPtr conn, const unsigned char *uuid,
memcpy
(
&
(
ret
->
uuid
[
0
]),
uuid
,
VIR_UUID_BUFLEN
);
ret
->
usageType
=
usageType
;
if
(
!
(
ret
->
usageID
=
strdup
(
usageID
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
usageID
,
usageID
)
<
0
)
goto
error
;
ret
->
conn
=
virObjectRef
(
conn
);
return
ret
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
@@ -775,16 +768,16 @@ virGetNWFilter(virConnectPtr conn, const char *name,
if
(
!
(
ret
=
virObjectNew
(
virNWFilterClass
)))
return
NULL
;
if
(
!
(
ret
->
name
=
strdup
(
name
))
)
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
name
,
name
)
<
0
)
goto
error
;
memcpy
(
&
(
ret
->
uuid
[
0
]),
uuid
,
VIR_UUID_BUFLEN
);
ret
->
conn
=
virObjectRef
(
conn
);
return
ret
;
no_memory:
virReportOOMError
();
error:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
@@ -832,13 +825,14 @@ virGetDomainSnapshot(virDomainPtr domain, const char *name)
if
(
!
(
ret
=
virObjectNew
(
virDomainSnapshotClass
)))
return
NULL
;
if
(
!
(
ret
->
name
=
strdup
(
name
)))
goto
no_memory
;
if
(
VIR_STRDUP
(
ret
->
name
,
name
)
<
0
)
goto
cleanup
;
ret
->
domain
=
virObjectRef
(
domain
);
return
ret
;
no_memory:
virReportOOMError
();
cleanup:
virObjectUnref
(
ret
);
return
NULL
;
}
...
...
src/libvirt.c
浏览文件 @
4960022a
...
...
@@ -213,11 +213,9 @@ static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
}
if (cred[i].type != VIR_CRED_EXTERNAL) {
if (STREQ(bufptr, "") && cred[i].defresult)
cred[i].result = strdup(cred[i].defresult);
else
cred[i].result = strdup(bufptr);
if (!cred[i].result)
if (VIR_STRDUP(cred[i].result,
STREQ(bufptr, "") && cred[i].defresult ?
cred[i].defresult : bufptr) < 0)
return -1;
cred[i].resultlen = strlen(cred[i].result);
}
...
...
@@ -1046,11 +1044,7 @@ virConnectOpenFindURIAliasMatch(virConfValuePtr value, const char *alias, char *
STREQLEN(entry->str, alias, alias_len)) {
VIR_DEBUG("Resolved alias '%s' to '%s'",
alias, offset+1);
if (!(*uri = strdup(offset+1))) {
virReportOOMError();
return -1;
}
return 0;
return VIR_STRDUP(*uri, offset+1);
}
entry = entry->next;
...
...
src/nodeinfo.c
浏览文件 @
4960022a
...
...
@@ -982,11 +982,8 @@ int nodeGetMemoryStats(int cellNum ATTRIBUTE_UNUSED,
FILE
*
meminfo
;
if
(
cellNum
==
VIR_NODE_MEMORY_STATS_ALL_CELLS
)
{
meminfo_path
=
strdup
(
MEMINFO_PATH
);
if
(
!
meminfo_path
)
{
virReportOOMError
();
if
(
VIR_STRDUP
(
meminfo_path
,
MEMINFO_PATH
)
<
0
)
return
-
1
;
}
}
else
{
# if WITH_NUMACTL
if
(
numa_available
()
<
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录