On 02/01/2018 10:35 AM, Daniel P. Berrangé wrote: > Since we annotate the APIs are having non-NULL parameters, we can remove > the checks for NULL in the code too. > > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> > --- > src/rpc/virnetserverclient.c | 47 ++++++++++++++++++++------------------------ > 1 file changed, 21 insertions(+), 26 deletions(-) > Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx> John > diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c > index d81a3892ff..388514946b 100644 > --- a/src/rpc/virnetserverclient.c > +++ b/src/rpc/virnetserverclient.c > @@ -466,14 +466,12 @@ virNetServerClientPtr virNetServerClientNew(unsigned long long id, > now))) > return NULL; > > - if (privNew) { > - if (!(client->privateData = privNew(client, privOpaque))) { > - virObjectUnref(client); > - return NULL; > - } > - client->privateDataFreeFunc = privFree; > - client->privateDataPreExecRestart = privPreExecRestart; > + if (!(client->privateData = privNew(client, privOpaque))) { > + virObjectUnref(client); > + return NULL; > } > + client->privateDataFreeFunc = privFree; > + client->privateDataPreExecRestart = privPreExecRestart; > > return client; > } > @@ -580,18 +578,18 @@ virNetServerClientPtr virNetServerClientNewPostExecRestart(virNetServerPtr srv, > } > virObjectUnref(sock); > > - if (privNew) { > - if (!(child = virJSONValueObjectGet(object, "privateData"))) { > - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", > - _("Missing privateData field in JSON state document")); > - goto error; > - } > - if (!(client->privateData = privNew(client, child, privOpaque))) > - goto error; > - client->privateDataFreeFunc = privFree; > - client->privateDataPreExecRestart = privPreExecRestart; > + if (!(child = virJSONValueObjectGet(object, "privateData"))) { > + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", > + _("Missing privateData field in JSON state document")); > + goto error; > } > > + if (!(client->privateData = privNew(client, child, privOpaque))) > + goto error; > + > + client->privateDataFreeFunc = privFree; > + client->privateDataPreExecRestart = privPreExecRestart; > + > > return client; > > @@ -637,14 +635,12 @@ virJSONValuePtr virNetServerClientPreExecRestart(virNetServerClientPtr client) > goto error; > } > > - if (client->privateData && client->privateDataPreExecRestart) { > - if (!(child = client->privateDataPreExecRestart(client, client->privateData))) > - goto error; > + if (!(child = client->privateDataPreExecRestart(client, client->privateData))) > + goto error; > > - if (virJSONValueObjectAppend(object, "privateData", child) < 0) { > - virJSONValueFree(child); > - goto error; > - } > + if (virJSONValueObjectAppend(object, "privateData", child) < 0) { > + virJSONValueFree(child); > + goto error; > } > > virObjectUnlock(client); > @@ -989,8 +985,7 @@ void virNetServerClientDispose(void *obj) > PROBE(RPC_SERVER_CLIENT_DISPOSE, > "client=%p", client); > > - if (client->privateData && > - client->privateDataFreeFunc) > + if (client->privateData) > client->privateDataFreeFunc(client->privateData); > > virObjectUnref(client->identity); > -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list