The same as for virDomainGraphicsListenAddAddress from previous commit
applies to this one too.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/domain_conf.c | 30 +++++++++++++++---------------
src/conf/domain_conf.h | 5 +++--
src/libvirt_private.syms | 2 +-
3 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c79a432..a1a73ac 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -23857,30 +23857,30 @@ virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
size_t i)
}
-/* Make a copy of up to len characters of address, and store it in
- * listens[i].network */
int
-virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
- size_t i, const char *network, int len)
+virDomainGraphicsListenAddNetwork(virDomainGraphicsDefPtr def,
+ int pos,
+ const char *network)
{
- virDomainGraphicsListenDefPtr listenInfo
- = virDomainGraphicsGetListen(def, i, true);
+ virDomainGraphicsListenDef listen;
- if (!listenInfo)
- return -1;
+ memset(&listen, 0, sizeof(listen));
- listenInfo->type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK;
+ listen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK;
- if (!network) {
- VIR_FREE(listenInfo->network);
- return 0;
- }
+ if (VIR_STRDUP(listen.network, network) < 0)
+ goto error;
+
+ if (VIR_INSERT_ELEMENT_COPY(def->listens, pos, def->nListens, listen) < 0)
+ goto error;
- if (VIR_STRNDUP(listenInfo->network, network, len) < 0)
- return -1;
return 0;
+ error:
+ VIR_FREE(listen.network);
+ return -1;
}
+
/**
* virDomainNetFind:
* @def: domain's def
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ed3d818..c1b26dd 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2825,8 +2825,9 @@ int virDomainGraphicsListenAddAddress(virDomainGraphicsDefPtr def,
const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
size_t i)
ATTRIBUTE_NONNULL(1);
-int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
- size_t i, const char *network, int len)
+int virDomainGraphicsListenAddNetwork(virDomainGraphicsDefPtr def,
+ int pos,
+ const char *network)
ATTRIBUTE_NONNULL(1);
int virDomainNetGetActualType(virDomainNetDefPtr iface);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index cc1c969..53eba5c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -301,10 +301,10 @@ virDomainGraphicsAuthConnectedTypeFromString;
virDomainGraphicsAuthConnectedTypeToString;
virDomainGraphicsDefFree;
virDomainGraphicsListenAddAddress;
+virDomainGraphicsListenAddNetwork;
virDomainGraphicsListenGetAddress;
virDomainGraphicsListenGetNetwork;
virDomainGraphicsListenGetType;
-virDomainGraphicsListenSetNetwork;
virDomainGraphicsListenSetType;
virDomainGraphicsSpiceChannelModeTypeFromString;
virDomainGraphicsSpiceChannelModeTypeToString;
--
2.7.4