Replace the two outstanding invocations and remove the function. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/rpc/virkeepalive.c | 2 +- src/rpc/virnetmessage.c | 25 ------------------------- src/rpc/virnetmessage.h | 2 -- src/rpc/virnetserverprogram.c | 9 ++------- 4 files changed, 3 insertions(+), 35 deletions(-) diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c index 9d08c3bcca..52decf5a5f 100644 --- a/src/rpc/virkeepalive.c +++ b/src/rpc/virkeepalive.c @@ -91,7 +91,7 @@ virKeepAliveMessage(virKeepAlive *ka, int proc) msg->header.proc = proc; if (virNetMessageEncodeHeader(msg) < 0 || - virNetMessageEncodePayloadEmpty(msg) < 0) { + virNetMessageEncodePayloadRaw(msg, NULL, 0) < 0) { virNetMessageFree(msg); goto error; } diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c index b806adf782..d78438bd95 100644 --- a/src/rpc/virnetmessage.c +++ b/src/rpc/virnetmessage.c @@ -496,31 +496,6 @@ int virNetMessageEncodePayloadRaw(virNetMessage *msg, } -int virNetMessageEncodePayloadEmpty(virNetMessage *msg) -{ - XDR xdr; - unsigned int msglen; - - /* Re-encode the length word. */ - VIR_DEBUG("Encode length as %zu", msg->bufferOffset); - xdrmem_create(&xdr, msg->buffer, VIR_NET_MESSAGE_HEADER_XDR_LEN, XDR_ENCODE); - msglen = msg->bufferOffset; - if (!xdr_u_int(&xdr, &msglen)) { - virReportError(VIR_ERR_RPC, "%s", _("Unable to encode message length")); - goto error; - } - xdr_destroy(&xdr); - - msg->bufferLength = msg->bufferOffset; - msg->bufferOffset = 0; - return 0; - - error: - xdr_destroy(&xdr); - return -1; -} - - void virNetMessageSaveError(struct virNetMessageError *rerr) { virErrorPtr verr; diff --git a/src/rpc/virnetmessage.h b/src/rpc/virnetmessage.h index 8f878962f8..849674fa53 100644 --- a/src/rpc/virnetmessage.h +++ b/src/rpc/virnetmessage.h @@ -85,8 +85,6 @@ int virNetMessageEncodePayloadRaw(virNetMessage *msg, const char *buf, size_t len) ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; -int virNetMessageEncodePayloadEmpty(virNetMessage *msg) - ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; void virNetMessageSaveError(struct virNetMessageError *rerr) ATTRIBUTE_NONNULL(1); diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c index 070d76fdd0..3ddf9f0428 100644 --- a/src/rpc/virnetserverprogram.c +++ b/src/rpc/virnetserverprogram.c @@ -518,14 +518,9 @@ int virNetServerProgramSendStreamData(virNetServerProgram *prog, if (virNetMessageEncodeHeader(msg) < 0) return -1; - if (data && len) { - if (virNetMessageEncodePayloadRaw(msg, data, len) < 0) - return -1; + if (virNetMessageEncodePayloadRaw(msg, data, len) < 0) + return -1; - } else { - if (virNetMessageEncodePayloadEmpty(msg) < 0) - return -1; - } VIR_DEBUG("Total %zu", msg->bufferLength); return virNetServerClientSendMessage(client, msg); -- 2.35.3