Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx> --- docs/schemas/network.rng | 13 ++++++--- src/conf/Makefile.inc.am | 2 ++ src/conf/network_conf.c | 60 ---------------------------------------- 3 files changed, 11 insertions(+), 64 deletions(-) diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 6127dae..919464d 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -258,7 +258,8 @@ and other features in the <dns> element --> <optional> <!-- VIRT:DIRECTIVE { - "structure": {"output": "src/conf/network_conf"} + "structure": {"output": "src/conf/network_conf"}, + "clearfunc": {"output": "src/conf/network_conf"} } --> <element name="dns"> <optional> @@ -275,7 +276,8 @@ <zeroOrMore> <!-- VIRT:DIRECTIVE { "name": "virNetworkDNSForwarder", - "structure": {"output": "src/conf/network_conf"} + "structure": {"output": "src/conf/network_conf"}, + "clearfunc": {"output": "src/conf/network_conf"} } --> <element name="forwarder"> <optional> @@ -289,7 +291,8 @@ </zeroOrMore> <zeroOrMore> <!-- VIRT:DIRECTIVE { - "structure": {"output": "src/conf/network_conf"} + "structure": {"output": "src/conf/network_conf"}, + "clearfunc": {"output": "src/conf/network_conf"} } --> <element name="txt"> <attribute name="name"><ref name="dnsName"/></attribute> @@ -298,7 +301,8 @@ </zeroOrMore> <zeroOrMore> <!-- VIRT:DIRECTIVE { - "structure": {"output": "src/conf/network_conf"} + "structure": {"output": "src/conf/network_conf"}, + "clearfunc": {"output": "src/conf/network_conf"} } --> <element name="srv"> <attribute name="service"><text/></attribute> @@ -331,6 +335,7 @@ <zeroOrMore> <!-- VIRT:DIRECTIVE { "structure": {"output": "src/conf/network_conf"}, + "clearfunc": {"output": "src/conf/network_conf"}, "members": [{"id": "hostname", "name": "name"}] } --> <element name="host"> diff --git a/src/conf/Makefile.inc.am b/src/conf/Makefile.inc.am index 1fbde38..b9ab535 100644 --- a/src/conf/Makefile.inc.am +++ b/src/conf/Makefile.inc.am @@ -161,6 +161,8 @@ DEVICE_CONF_SOURCES = \ $(NULL) CONF_GENERATED_SOURCES = \ + conf/network_conf.generated.c \ + conf/network_conf.generated.h \ $(NULL) CONF_SOURCES = \ diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 84b4887..060d0e3 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -156,66 +156,6 @@ virNetworkIPDefClear(virNetworkIPDefPtr def) } -static void -virNetworkDNSTxtDefClear(virNetworkDNSTxtDefPtr def) -{ - VIR_FREE(def->name); - VIR_FREE(def->value); -} - - -static void -virNetworkDNSHostDefClear(virNetworkDNSHostDefPtr def) -{ - while (def->nnames) - VIR_FREE(def->names[--def->nnames]); - VIR_FREE(def->names); -} - - -static void -virNetworkDNSSrvDefClear(virNetworkDNSSrvDefPtr def) -{ - VIR_FREE(def->domain); - VIR_FREE(def->service); - VIR_FREE(def->protocol); - VIR_FREE(def->target); -} - - -static void -virNetworkDNSForwarderClear(virNetworkDNSForwarderPtr def) -{ - VIR_FREE(def->domain); -} - - -static void -virNetworkDNSDefClear(virNetworkDNSDefPtr def) -{ - if (def->forwarders) { - while (def->nforwarders) - virNetworkDNSForwarderClear(&def->forwarders[--def->nforwarders]); - VIR_FREE(def->forwarders); - } - if (def->txts) { - while (def->ntxts) - virNetworkDNSTxtDefClear(&def->txts[--def->ntxts]); - VIR_FREE(def->txts); - } - if (def->hosts) { - while (def->nhosts) - virNetworkDNSHostDefClear(&def->hosts[--def->nhosts]); - VIR_FREE(def->hosts); - } - if (def->srvs) { - while (def->nsrvs) - virNetworkDNSSrvDefClear(&def->srvs[--def->nsrvs]); - VIR_FREE(def->srvs); - } -} - - static void virNetworkForwardDefClear(virNetworkForwardDefPtr def) { -- 2.17.1