Replace the last use of the function by virDomainDiskInsert and remove the unused helper. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/domain_conf.c | 16 ++-------------- src/conf/domain_conf.h | 2 -- src/libvirt_private.syms | 1 - 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e35c38caa3..4ec6484b78 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15488,13 +15488,6 @@ virDomainDiskByTarget(virDomainDef *def, void virDomainDiskInsert(virDomainDef *def, virDomainDiskDef *disk) -{ - def->disks = g_renew(virDomainDiskDef *, def->disks, def->ndisks + 1); - virDomainDiskInsertPreAlloced(def, disk); -} - -void virDomainDiskInsertPreAlloced(virDomainDef *def, - virDomainDiskDef *disk) { int idx; /* Tentatively plan to insert disk at the end. */ @@ -15521,9 +15514,7 @@ void virDomainDiskInsertPreAlloced(virDomainDef *def, } } - /* VIR_INSERT_ELEMENT_INPLACE will never return an error here. */ - ignore_value(VIR_INSERT_ELEMENT_INPLACE(def->disks, insertAt, - def->ndisks, disk)); + ignore_value(VIR_INSERT_ELEMENT(def->disks, insertAt, def->ndisks, disk)); } @@ -19539,9 +19530,6 @@ virDomainDefParseXML(xmlDocPtr xml, if ((n = virXPathNodeSet("./devices/disk", ctxt, &nodes)) < 0) goto error; - if (n) - def->disks = g_new0(virDomainDiskDef *, n); - for (i = 0; i < n; i++) { virDomainDiskDef *disk = virDomainDiskDefParseXML(xmlopt, nodes[i], @@ -19550,7 +19538,7 @@ virDomainDefParseXML(xmlDocPtr xml, if (!disk) goto error; - virDomainDiskInsertPreAlloced(def, disk); + virDomainDiskInsert(def, disk); } VIR_FREE(nodes); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index fab856a5c7..a0855d816e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3548,8 +3548,6 @@ virDomainDiskByTarget(virDomainDef *def, const char *dst); void virDomainDiskInsert(virDomainDef *def, virDomainDiskDef *disk); -void virDomainDiskInsertPreAlloced(virDomainDef *def, - virDomainDiskDef *disk); int virDomainStorageNetworkParseHost(xmlNodePtr hostnode, virStorageNetHostDef *host); int virDomainDiskDefAssignAddress(virDomainXMLOption *xmlopt, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6fbdee4124..e6b4ce5bea 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -389,7 +389,6 @@ virDomainDiskGetType; virDomainDiskIndexByAddress; virDomainDiskIndexByName; virDomainDiskInsert; -virDomainDiskInsertPreAlloced; virDomainDiskIoTypeFromString; virDomainDiskIoTypeToString; virDomainDiskMirrorStateTypeFromString; -- 2.31.1