On Tue, Mar 10, 2015 at 17:45:12 +0100, Michal Privoznik wrote: > So far, this is pure code replacement. But once we introduce > reference counting to virNetworkObj this will be more handy as > there'll be only one function to change: virNetworkObjEndAPI(). Not entirely true ... > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > src/parallels/parallels_network.c | 29 ++++++++++++----------------- > 1 file changed, 12 insertions(+), 17 deletions(-) > > diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c > index 86038bf..1bcd2d3 100644 > --- a/src/parallels/parallels_network.c > +++ b/src/parallels/parallels_network.c > @@ -230,7 +230,6 @@ parallelsLoadNetwork(parallelsConnPtr privconn, virJSONValuePtr jobj) > goto cleanup; > net->active = 1; > net->autostart = 1; > - virObjectUnlock(net); ... this ... > return net; > > cleanup: > @@ -241,7 +240,7 @@ parallelsLoadNetwork(parallelsConnPtr privconn, virJSONValuePtr jobj) > static virNetworkObjPtr > parallelsAddRoutedNetwork(parallelsConnPtr privconn) > { > - virNetworkObjPtr net; > + virNetworkObjPtr net = NULL; > virNetworkDefPtr def; > > if (VIR_ALLOC(def) < 0) > @@ -265,7 +264,6 @@ parallelsAddRoutedNetwork(parallelsConnPtr privconn) > } > net->active = 1; > net->autostart = 1; > - virObjectUnlock(net); > > return net; > > @@ -277,7 +275,7 @@ parallelsAddRoutedNetwork(parallelsConnPtr privconn) > static int parallelsLoadNetworks(parallelsConnPtr privconn) > { > virJSONValuePtr jobj, jobj2; > - virNetworkObjPtr net; > + virNetworkObjPtr net = NULL; > int ret = -1; > int count; > size_t i; > @@ -305,16 +303,19 @@ static int parallelsLoadNetworks(parallelsConnPtr privconn) > net = parallelsLoadNetwork(privconn, jobj2); > if (!net) > goto cleanup; > + else > + virNetworkObjEndAPI(&net); ... is a somewhat semantic change. > > } > > - if (!parallelsAddRoutedNetwork(privconn)) > + if (!(net = parallelsAddRoutedNetwork(privconn))) > goto cleanup; > > ret = 0; > > cleanup: > virJSONValueFree(jobj); > + virNetworkObjEndAPI(&net); > return ret; > } > Anyways. ACK. Peter
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list