提交 914d1b74 编写于 作者: D Daniel P. Berrange

Add missing 'const' annotations for internal domain conf helpers

The virDomainNetGetActualBridgeName and virDomainNetGetActualDirectDev
methods both return strings that point to data in the virDomainDefPtr
struct, and should therefore not be freed. The return values should
thus be 'const char *' not 'char *'.

* src/conf/domain_conf.c, src/conf/domain_conf.h: Mark const
* src/network/bridge_driver.c: Update to use a const char *
上级 0c1587e1
......@@ -13064,7 +13064,7 @@ virDomainNetGetActualType(virDomainNetDefPtr iface)
return iface->data.network.actual->type;
}
char *
const char *
virDomainNetGetActualBridgeName(virDomainNetDefPtr iface)
{
if (iface->type == VIR_DOMAIN_NET_TYPE_BRIDGE)
......@@ -13076,7 +13076,7 @@ virDomainNetGetActualBridgeName(virDomainNetDefPtr iface)
return iface->data.network.actual->data.bridge.brname;
}
char *
const char *
virDomainNetGetActualDirectDev(virDomainNetDefPtr iface)
{
if (iface->type == VIR_DOMAIN_NET_TYPE_DIRECT)
......
......@@ -1794,8 +1794,8 @@ int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
ATTRIBUTE_NONNULL(1);
int virDomainNetGetActualType(virDomainNetDefPtr iface);
char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface);
char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface);
const char *virDomainNetGetActualBridgeName(virDomainNetDefPtr iface);
const char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface);
int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface);
virNetDevVPortProfilePtr
virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface);
......
......@@ -2899,7 +2899,7 @@ networkNotifyActualDevice(virDomainNetDefPtr iface)
struct network_driver *driver = driverState;
virNetworkObjPtr network;
virNetworkDefPtr netdef;
char *actualDev;
const char *actualDev;
int ret = -1;
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK)
......@@ -2925,8 +2925,8 @@ networkNotifyActualDevice(virDomainNetDefPtr iface)
if (!actualDev) {
networkReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("the interface uses a direct mode, but has no source dev"));
goto cleanup;
}
goto cleanup;
}
netdef = network->def;
if (netdef->nForwardIfs == 0) {
......@@ -2999,7 +2999,7 @@ networkReleaseActualDevice(virDomainNetDefPtr iface)
struct network_driver *driver = driverState;
virNetworkObjPtr network = NULL;
virNetworkDefPtr netdef;
char *actualDev;
const char *actualDev;
int ret = -1;
if (iface->type != VIR_DOMAIN_NET_TYPE_NETWORK)
......@@ -3026,8 +3026,8 @@ networkReleaseActualDevice(virDomainNetDefPtr iface)
if (!actualDev) {
networkReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("the interface uses a direct mode, but has no source dev"));
goto cleanup;
}
goto cleanup;
}
netdef = network->def;
if (netdef->nForwardIfs == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册