mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
rpc: assume private data callbacks are always non-NULL
Since we annotate the APIs are having non-NULL parameters, we can remove the checks for NULL in the code too. Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
72874b2d11
commit
17398ccef3
@ -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;
|
||||
}
|
||||
|
||||
return client;
|
||||
}
|
||||
@ -580,17 +578,17 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
return client;
|
||||
@ -637,7 +635,6 @@ virJSONValuePtr virNetServerClientPreExecRestart(virNetServerClientPtr client)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (client->privateData && client->privateDataPreExecRestart) {
|
||||
if (!(child = client->privateDataPreExecRestart(client, client->privateData)))
|
||||
goto error;
|
||||
|
||||
@ -645,7 +642,6 @@ virJSONValuePtr virNetServerClientPreExecRestart(virNetServerClientPtr client)
|
||||
virJSONValueFree(child);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
virObjectUnlock(client);
|
||||
return object;
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user