提交 17398cce 编写于 作者: D Daniel P. Berrangé

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: NJohn Ferlan <jferlan@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 72874b2d
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册