virDomainNetIPInfoFormat() and virDomainNetIPInfoParseXML() were previously defined as global functions (but declared in the .c file directly above their definition) to avoid the "static function defined but not called" error during compile. Now that both are used, they can be properly defined as static functions. And since virDomainNetIPInfoFormat() is now the only caller of virDomainNetIPsFormat() and virDomainNetRoutesFormat(), those two functions can simply be subsumed into virDomainNetIPInfoFormat(). --- src/conf/domain_conf.c | 46 ++++++++++------------------------------------ 1 file changed, 10 insertions(+), 36 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9dcfb57..df52ac9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6163,11 +6163,7 @@ virDomainNetIPParseXML(xmlNodePtr node) * * return 0 on success (including none found) and -1 on failure. */ -int -virDomainNetIPInfoParseXML(const char *source, - xmlXPathContextPtr ctxt, - virNetDevIPInfoPtr def); -int +static int virDomainNetIPInfoParseXML(const char *source, xmlXPathContextPtr ctxt, virNetDevIPInfoPtr def) @@ -20232,14 +20228,16 @@ virDomainFSDefFormat(virBufferPtr buf, return 0; } + static int -virDomainNetIPsFormat(virBufferPtr buf, virNetDevIPAddrPtr *ips, size_t nips) +virDomainNetIPInfoFormat(virBufferPtr buf, + virNetDevIPInfoPtr def) { size_t i; /* Output IP addresses */ - for (i = 0; i < nips; i++) { - virSocketAddrPtr address = &ips[i]->address; + for (i = 0; i < def->nips; i++) { + virSocketAddrPtr address = &def->ips[i]->address; char *ipStr = virSocketAddrFormat(address); const char *familyStr = NULL; @@ -20254,42 +20252,18 @@ virDomainNetIPsFormat(virBufferPtr buf, virNetDevIPAddrPtr *ips, size_t nips) VIR_FREE(ipStr); if (familyStr) virBufferAsprintf(buf, " family='%s'", familyStr); - if (ips[i]->prefix != 0) - virBufferAsprintf(buf, " prefix='%u'", ips[i]->prefix); + if (def->ips[i]->prefix) + virBufferAsprintf(buf, " prefix='%u'", def->ips[i]->prefix); virBufferAddLit(buf, "/>\n"); } - return 0; -} - -static int -virDomainNetRoutesFormat(virBufferPtr buf, - virNetDevIPRoutePtr *routes, - size_t nroutes) -{ - size_t i; - for (i = 0; i < nroutes; i++) - if (virNetDevIPRouteFormat(buf, routes[i]) < 0) + for (i = 0; i < def->nroutes; i++) + if (virNetDevIPRouteFormat(buf, def->routes[i]) < 0) return -1; return 0; } -int -virDomainNetIPInfoFormat(virBufferPtr buf, - virNetDevIPInfoPtr def); -int -virDomainNetIPInfoFormat(virBufferPtr buf, - virNetDevIPInfoPtr def) -{ - if (virDomainNetIPsFormat(buf, def->ips, def->nips) < 0) - return -1; - if (virDomainNetRoutesFormat(buf, def->routes, def->nroutes) < 0) - return -1; - return 0; -} - - static int virDomainHostdevDefFormatSubsys(virBufferPtr buf, virDomainHostdevDefPtr def, -- 2.5.5 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list